just created an UITableView,
trying to display some custom data from an array, but what ever I do, i get no text displayed.
NSLog tell me the right text and right amout but no text in table cell.
here is the code:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier];
}
cell.textLabel.text = @"test";
[self configureCell:cell atIndexPath:indexPath];
return cell;
}
Things to check:
Is
cellForRowAtIndexPathgetting called? Put a breakpoint inMake an array in ViewDidLoad (property, alloc’d) and
addObjects @"One", @"Two", @"Three", niland thencell.textLabel.text = [theArray objectAtIndex:indexPath.row];If
cellForRowis being called, this will show in the cells.What does
ConfigureCelldo? Include the code please.Also check your tableView delegate methods are being called (
NumberofRowsInSectionetc)