大佬教程收集整理的这篇文章主要介绍了iphone – 向UITableView添加行时的NSInternalInconsistencyException,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我有空的NSMutableArray * dataForList和UITableView的数据.点击屏幕后,我想添加新行.此错误显示:
码:
NSArray *insertIndexPaths = [NSArray arrayWithObject: [NSIndexPath indexPathForRow: [self.dataForList count] // is zero Now inSection:0]]; [self.dataForList addObject:newRow]; // [self.dataForList count] is 1 Now [self.unsignedTableView beginUpdates]; [self.unsignedTableView insertRowsAtIndexPaths:insertIndexPaths withRowAnimation:UITableViewRowAnimationNone]; [self.unsignedTableView endUpdates]; // on this line error ocours
我错过了什么?
所有UITableView方法
- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *) indexPath {} - (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { return 1; } - (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger) section { return [self.mainController.dataForList count]; } - (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *) indexPath{ return 38.0f; } - (UITableViewCell *) tableView: (UITableView *) tableView cellForRowAtIndexPath: (NSIndexPath *) indexPath { // call render method in view,it works fain return [self.signUpToTestView renderUnsignedCell:tableView cellForRowAtIndexPath:indexPath]; }
return [arr count];
并尝试重新加载表格
[table reloadData];
以上是大佬教程为你收集整理的iphone – 向UITableView添加行时的NSInternalInconsistencyException全部内容,希望文章能够帮你解决iphone – 向UITableView添加行时的NSInternalInconsistencyException所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。