Rob*_*rtL 42 iphone uitableview
在tableView:cellForRowAtIndexPath:我有以下几点:
cell.textLabel.text = @"label";
cell.detailTextLabel.text = @"detail";
Run Code Online (Sandbox Code Playgroud)
这些textLabel节目如预期的那样,但detailTextLabel根本没有出现,尽管没有诊断.我所期望的是"细节"文本将出现在第二行的单元格中,低于"普通"文本,可能具有较小的字体大小.
在这里的另一个帖子中询问同样的问题,用户"jbrennan"回答说tableview单元格样式必须是其他的UITableViewCellStylePlain.但是,似乎只有两种可能的样式,UITableViewCellStylePlain并且UITableViewCellStyleGrouped.我得到相同的结果(细节标签没有出现).
我在文档中没有看到另一种单元格样式吗?UITableView上次更新中是否有更改并且detailTextLabel不再可用?我是否必须做一些额外的事情才能让它出现?有什么建议?
我正在使用xcode 3.2.5并为iPhone 4.2模拟器构建.
Aur*_*ila 117
您的初始化需要更改为:
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle
reuseIdentifier:CellIdentifier] autorelease];Run Code Online (Sandbox Code Playgroud)
我强调并加粗了你需要改变的部分.
W D*_*son 14
分配时,需要将单元格类型设置为Subtitle.
if (!cell) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:BasicCellIdentifier];
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
58124 次 |
| 最近记录: |