其实我没有看到我的错误:UITableView的数据源必须的tableView返回细胞:的cellForRowAtIndexPath:异常
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
FriendTableViewCell *cell = (FriendTableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[FriendTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
[[NSBundle mainBundle] loadNibNamed:@"FriendTableViewCell" owner:self options:nil];
cell = friendCell;
}
cell.lblNickname.text = @"Tester";
return cell;
}
我到底做错了什么?我检查了两次..但没有看到错误。
感谢您的帮助!
谢谢,再次签入后,我发现在Interface Builder中缺少插座连接! – phx 2010-02-09 17:39:26
谢谢,你的回答正是我所需要的。我改变了视图控制器类的名称,打破了与IB的连接,而没有考虑到它。没有更多改变的名字,因为我不喜欢它们! – 2010-11-23 09:35:57
很好的答案,通常问题是关于返回一个零单元格! – Fattie 2013-11-05 16:14:39