其實我沒有看到我的錯誤: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