首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >UITableView detailTextLabel - iphone开发

UITableView detailTextLabel - iphone开发
EN

Stack Overflow用户
提问于 2011-07-24 00:55:52
回答 2查看 1.8K关注 0票数 0

为什么"detailTextLabel“不再起作用?

代码语言:javascript
复制
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    }

    // Configure the cell.
    cell.textLabel.text=[listData objectAtIndex:[indexPath row]];
    cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;


    cell.detailTextLabel.text=@"hi";
    return cell;
}
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2011-07-24 01:05:55

尝试更改单元格的样式,请在初始化单元格时使用此代码

代码语言:javascript
复制
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle 
                                   reuseIdentifier:CellIdentifier] autorelease];  

有关单元格样式的更多信息,请查看apple's class reference

票数 7
EN

Stack Overflow用户

发布于 2011-07-24 01:05:58

您选择了不支持detailTextLabel的单元格样式UITableViewCellStyleDefault

尝试使用不同的样式。

编辑

您可以在initWithStyle:reuseIdentifier;方法中选择样式。看一下描述可用单元格样式的UITableViewCell文档。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6801911

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档