iphone - UITableView 单元格文本不显示?

标签 iphone objective-c uitableview

我没有看到我的 UITableView 的文本显示。事实上,TableView 似乎根本没有出现在屏幕上,因为我无法选择空行。

奇怪的是,我在 cellForRowAtIndexPath 中的登录显示预期数据正常 - 我只是在屏幕上看不到任何数据。

 -(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;

我继承了一个基类,它是一个 UITableViewController,就像我在项目中继承了十几个其他屏幕一样。知道为什么我没有看到 tableView 吗?

最佳答案

您的字体颜色与背景颜色相同吗?如果将 accessoryType 设置为复选标记,它会显示吗?

      cell.accessoryType = UITableViewCellAccessoryCheckmark;

关于iphone - UITableView 单元格文本不显示?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3833551/

相关文章:

swift - UITableView 静态和动态部分单元格的混合?抛出错误 -[__NSSingleObjectArrayI objectAtIndex :]: index 1 beyond bounds [0 . 。 0]'

ios - 将文件 url 从 documentDirectory 加载到 TableView

ios - 访问 heightForRowAtIndexPath 中的自定义单元格属性

iphone - IOS 应用程序完全使用 HTML 5 创建 - 输入延迟...可以修复吗?

ios - 在 App Store Italy 上发布应用程序后,iAd 未在设备上显示

objective-c - Obj C - 有没有办法让方法返回调用它的方法?

objective-c - 将数据传输回原始 View

iphone - 如何使用同一个应用程序查找附近的 iOS 设备(GPS 位置)

iphone - 比较两个自定义单元格中 UILables 的值

iphone - 核心数据对多关系问题