大佬教程收集整理的这篇文章主要介绍了ios – 将额外的行添加到由NSFetchedResultsController管理的UITableView,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
然而,我想添加一个唯一的单元格作为表的最后一个单元格,与NSFetchedResultsController的谓词生成的项目无关,我希望这个单元格始终位于表的底部.
- (NSUInteger)numberOfSectionsInTableView:(UITableView *)sender { return [[self.fetchedResultsController sections] count] + 1; } - (NSUInteger)tableView:(UITableView *)sender numberOfRowsInSection:(NSUInteger)section { return [[[self.fetchedResultsController sections] objectATindex:section] numberOfObjects] + 1; }
- (UITableViewCell *)tableView:(UITableView *)sender cellForRowATindexPath:(NSIndexPath *)indexPath { if (indexPath.row == [self.fetchedResultsController.fetchedObjects count]) { //Generate the last cell in table. } else { //Generate the rest of the cells like normal. } return nil; //To keep the compiler happy. }
这将检查索引是否是最后一个单元格,并适当地处理.
但是我仍然在运行时收到以下错误:
*** TerminaTing app due to uncaught exception 'NSRangeException',reason: '*** -[__NSArraym objectATindex:]: index 1 beyond bounds [0 .. 0]'
任何想法是什么导致这个?还是有更好的方法来添加一个额外的行到由NSFetchedResultsController控制的表视图?
以上是大佬教程为你收集整理的ios – 将额外的行添加到由NSFetchedResultsController管理的UITableView全部内容,希望文章能够帮你解决ios – 将额外的行添加到由NSFetchedResultsController管理的UITableView所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。