[__NSArrayM objectAtIndex:]: ind

2018-07-11  本文已影响14人  陆壹吱吱

_observer = [[NSNotificationCenter defaultCenter] addObserverForName:YZUpdateMenuTitleNote object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification * _Nonnull note) {

NSInteger col = [self.controllers indexOfObject:note.object];

if(col != NSNotFound) // <-

        {

// 获取对应按钮

UIButton *btn = self.menuButtons[col];

// 隐藏下拉菜单

 [self dismiss];

// 获取所有值

NSArray *allValues = note.userInfo.allValues;

// 不需要设置标题,字典个数大于1,或者有数组

if (allValues.count > 1 || [allValues.firstObject isKindOfClass:[NSArray class]]) return ;

// 设置按钮标题

 [btn setTitle:allValues.firstObject forState:UIControlStateNormal];

        }

上一篇 下一篇

猜你喜欢

热点阅读