iOS indexOfObject使用

-(NSUInteger)indexOfObject:(ObjectType)anObject;

点击这里官方文档
Return Value
The lowest index whose corresponding array value is equal to anObject.
If none of the objects in the array is equal to anObject, returns NSNotFound.

[[NetworkTool managerTool] requesNoHud:POST UrlString:[HttpInterface getJinTiKuProfession] parameters:mdict finished:^(id result, NSError *error) {
        if (result) {
            if ([[result objectForKey:@"success"]boolValue]) {
                NSDictionary * info = [result objectForKey:@"entity"][@"info"];
                self.infoModel = [WJSubjectCategoryModel mj_objectArrayWithKeyValuesArray:info];
                
                [self.leftTableView reloadData];
                [self.rightTableView reloadData];
                
                NSMutableArray * mArray = [[NSMutableArray alloc]init];
                // 遍历self.infoModel数组,把status的值拿出来,存入数组
                for (WJSubjectCategoryModel * model in self.infoModel) {
                    [mArray addObject:model.status];
                }
                // The lowest index whose corresponding array value is equal to anObject. If none of the objects in the array is equal to anObject, returns NSNotFound.
                // 对应数组值等于一个对象的最低索引
                NSUInteger index = [mArray indexOfObject:@"0"];
//                if (index == NSNotFound) {
//                    index = 0;
//                }
                
                [self.leftTableView selectRowAtIndexPath:[NSIndexPath indexPathForRow:index inSection:0]
                                                   animated:YES
                                             scrollPosition:UITableViewScrollPositionNone];
            }else{
                [MBProgressHUD showError:[result objectForKey:@"message"]];
            }
        }else{
            [MBProgressHUD showError:@"格式错误"];
        }
        
    }];
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值