iphone - cell.detailTextLabel.text 不起作用...为什么

标签 iphone xcode uitableview

使用以下代码我得到了text.label,但没有得到detailTextLabel.text。 NSLog 显示正确。

cell.textLabel.text = [eventLabels objectAtIndex:indexPath.row];  
cell.detailTextLabel.text = [eventFields objectAtIndex:indexPath.row]];  

NSLog(@"%@", [eventFields objectAtIndex:indexPath.row]);  

我也尝试过...

cell.detailTextLabel.text = [NSString stringWithFormat:@"%@", [eventFields objectAtIndex:indexPath.row]];     

我以前没有遇到过这个问题。有什么建议吗?

约翰

最佳答案

确保您使用适当的UITableViewCellStyle(因此除了UITableViewCellStyleDefault之外的任何内容都应该有效)。单元格的样式是在初始化时指定的。

关于iphone - cell.detailTextLabel.text 不起作用...为什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2349279/

相关文章:

iphone - 从子 UIViewController 呈现 UIActionSheet

ios - 什么时候在 Objective-C 中使用 self?

ios - UITableView 嵌套在没有边距的 UICollectionViewCell 中

ios - TableView didselectrowatindex 返回 nil (Swift)

ios - 表格 View 的高度与另一个不同,即使它们以相同的方式初始化

ios - xcode 7 - image.xcassets 中缺少对 Retina 4 的支持

ios - 无法构造“任务”,因为它没有可访问的初始值设定项

iphone - 如何在应用程序的设置包中显示应用程序版本修订?

objective-c - iOS - 自动布局的比例间距

iphone - UIActivityView 不显示其他应用程序作为打开 pdf 的选项