I have subclassed UITableViewCell as MyCell and am attempting to get the table to show. I always receive the message:
exception 'NSInternalInconsistencyException', reason: 'UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:
The code for tableView:cellForRowAtIndexPath is as follows:
- (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;
}
I have set the CellIdentifier as “Cell” in the nib. I thought I was returning a cell with the last line?
Where am I going wrong?
Your cell must be nil. You should white something like: