I am implementing a dynamic table view. This table view controller is pushed in via a button touch on another view controller. But nothing is displayed on the screen even though the log indicates that the cell rows are being set correctly. What could be the reason? I have implemented the number of sections to be 1. Here is the code in the table view controller:
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
NSLog(@"Row count :%d",self.playerNames.count + 1);
return self.playerNames.count + 1;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"PlayerName";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
if (indexPath.row < self.playerNames.count) {
cell.textLabel.text = [self.playerNames objectAtIndex:indexPath.row];
}
NSLog(@"Cell Text :%@",cell.textLabel.text);
return cell;
}