UITableView编译遇见configureCellForDisplay问题

UITableView编译遇见保错Assertion failure in [UITableView _configureCellForDisplay:forIndexPath]分为两种情况:

1、创建UITableViewCell的代理方法中UITableViewCell没有设置identify。

2、创建UITableViewCell的代理方法中返回为nil 。

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 1;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *ceCellIdentifier = @"ConsumeTableViewCell";
    ConsumeTableViewCell *cell =[tableView dequeueReusableCellWithIdentifier:ceCellIdentifier];
        if (cell == nil){
            cell = [[ConsumeTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ceCellIdentifier];
            cell.selectionStyle = UITableViewCellSelectionStyleNone;
            cell.contentView.backgroundColor = [UIColor clearColor];
            cell.backgroundColor = [UIColor clearColor];
        }
    return cell;
}


你可能感兴趣的:(UITableView,[UITableView)