UITableViewCell
asをサブクラスMyCell
化し、テーブルを表示しようとしています。私はいつもメッセージを受け取ります:
exception 'NSInternalInconsistencyException', reason: 'UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:
のコードtableView:cellForRowAtIndexPath
は次のとおりです。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
MyCell* cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
// Configure the cell...
MyCell* theCell = (MyCell *)cell;
UILabel* lab = theCell.theLabel;
lab.text = @"This is the label text";
return cell;
}
ペン先でCellIdentifierを「Cell」として設定しました。最後の行でセルを返していると思いましたか? どこが間違っていますか?