Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:]


2016-02-29 15:46:54.217 ShinowDonor[7693:203230] *** Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3512.30.14/UITableView.m:7962


2016-02-29 15:46:54.227 ShinowDonor[7693:203230] LaunchServices: ERROR: There is no registered handler for URL scheme mailto


2016-02-29 15:46:54.227 ShinowDonor[7693:203230] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UITableView (<UITableView: 0x7f85930f9400; frame = (0 0; 375 667); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x7f85940a5db0>; layer = <CALayer: 0x7f8591ff0dd0>; contentOffset: {0, 0}; contentSize: {375, 308}>) failed to obtain a cell from its dataSource (<MyUseViewController: 0x7f8591e6b090>)'


笔者的这个错误原因是  每个判断都应该return  cell

    switch (indexPath.row)

    {

        case 1:

        {

            MyUseNickNameCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell1"];

            if (cell ==  nil)

            {

                cell = [[NSBundle mainBundle] loadNibNamed:@"MyUseNickNameCell" owner:nil options:nil][0];

            }

            cell.nickNameLabel.text = [NSString stringWithFormat:@"%@",_model.nick_name] ;

        }

            break;

        case 2:

        {

            MyUseSexCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell2"];

            if (cell ==  nil)

            {

                cell = [[NSBundle mainBundle] loadNibNamed:@"MyUseSexCell" owner:nil options:nil][0];

            }

            cell.sexLabel.text = _model.sex;

        }

            break;


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值