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;