*** Terminating app due to uncaught exception ‘NSInternalInconsistencyException’,reason: ‘Attempted to dequeue
multiple cells for the same index path,which is not allowed. If you
really need to dequeue more cells than the table view is requesting,
use the -dequeueReusableCellWithIdentifier: method (without an index
path). Cell identifier: WorkOrderCell,index path: {length = 2,path = 0 – 0}’
我已经回顾了很多教程,我觉得这个代码没有什么特别的错误.事实上,正常的网格加载工作正常,这是我的代码:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"WorkOrderCell" forIndexPath:indexPath]; // Configure the cell... do some work,return it return cell; }
有没有其他人遇到过这个问题,你做了什么来解决它?
我应该更具体一点,正常的UITableView确实加载得很好,这个具体的问题是我有一个SearchBar,当用户输入搜索时,我正在过滤结果并显示结果网格:
//Start Search/Filter Code - (void)filterContentForSearchText:(Nsstring*)searchText scope:(Nsstring*)scope { nspredicate *resultPredicate = [nspredicate predicateWithFormat:@"Job contains[cd] %@ or Address contains[cd] %@ or WorkOrderId contains[cd] %@ or Supervisor contains[cd] %@",searchText,searchText]; self.filteredWorkOrders = [self.workOrders filteredArrayUsingPredicate:resultPredicate]; } -(BOOL)searchdisplayController:(UISearchdisplayController *)controller shouldReloadTableForSearchString:(Nsstring *)searchString { [self filterContentForSearchText:searchString scope:[[self.searchdisplayController.searchBar scopeButtonTitles] objectAtIndex:[self.searchdisplayController.searchBar selectedScopeButtonIndex]]]; return YES; }
过滤器代码本身工作正常,它只是触发UITableView委托来触发,它开始出列单元格(在搜索结果网格中应该是空的?)
无论如何,我可以使用这个帮助…..
解决方法
原文地址:https://www.jb51.cc/iOS/328737.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。