开发者

UITableView cell text not showing?

开发者 https://www.devze.com 2023-01-18 18:57 出处:网络
I\'m not seeing the text for my UITableView show up.. in fact the TableView doesn\'t appear to be on the screen at all because I cannot select the empty rows.

I'm not seeing the text for my UITableView show up.. in fact the TableView doesn't appear to be on the screen at all because I cannot select the empty rows.

Strangely, my log in cellForRowAtIndexPath shows up ok with the expected data - I just don't see any on the screen.

 -(void)bindFriendsToTable:(NSArray *)friends{
NSLog(@"friends : %@",friends);
[sections removeAllObjects];
[sectionRows removeAllObjects];

[sections addObject:@"Friends"];
[sectionRows setObject:friends forKey:@"Friends"];  

[self.tableView reloadData];
HideActivityIndicator();

}

 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *cellsection = [sections objectAtIndex:indexPath.section];
NSArray *rowsInSection = [sectionRows valueForKey:cellsection];

static NSString *CellIdentifier = @"Cell";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault开发者_开发知识库 reuseIdentifier:CellIdentifier] autorelease];
}

cell.textLabel.font = [UIFont fontWithName:@"Helvetica" size:14];
[cell setSelectionStyle:UITableViewCellSelectionStyleNone]; 
cell.textLabel.text = [rowsInSection objectAtIndex:indexPath.row];
NSLog(@"%@",cell.textLabel.text);

return cell;

}

I'm inheriting from a base class which is a UITableViewController, as I have for a dozen other screens in the project. Any idea why I'm not seeing the tableView?


Is your font colour the same as your background colour? If you set the accessoryType to a checkmark does it display?

      cell.accessoryType = UITableViewCellAccessoryCheckmark;


Do you have any header sections? If so make sure you return a value for heightForHeaderInSection:

-(float)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
      return 66;
}


i think u should remove [cell setSelectionStyle:UITableViewCellSelectionStyleNone]; and then try it. and display the other static string in the cell to check the problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消