小编use*_*607的帖子

UITableView dataSource必须从tableView:cellForRowAtIndexPath返回单元格

我在我的搜索栏中添加了一个问题ViewController.

我收到以下错误:

Assertion failure in -[UISearchResultsTableView _configureCellForDisplay:forIndexPath:], /SourceCache/UIKit/UIKit-2935.137/UITableView.m:6509
2014-04-03 18:08:24.355 MyFood[6405:60b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:'
Run Code Online (Sandbox Code Playgroud)

configureCell:

- (void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath {        
    //    ToDos *toDo = [self.fetchedResultsController objectAtIndexPath:indexPath];
    if (viewMode==AlphabeticalOrder) {
        Inventory *toDo=nil;
        if (self.searchDisplayController.isActive) {
            toDo = [searchResults objectAtIndex:indexPath.row];
        } else {
            toDo=[inventoryProducts objectAtIndex:indexPath.row];
        }
        cell.textLabel.text = toDo.inventoryProductName;
        NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
        [formatter setDateStyle:NSDateFormatterShortStyle];
        NSDate *dt = toDo.expireDate;
        NSString *dateAsString = …
Run Code Online (Sandbox Code Playgroud)

uitableview uisearchbar ios

5
推荐指数
3
解决办法
9159
查看次数

标签 统计

ios ×1

uisearchbar ×1

uitableview ×1