UITableView detailTextLabel-iPhone开发 [英] UITableView detailTextLabel - iphone development

查看:61
本文介绍了UITableView detailTextLabel-iPhone开发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

why is "detailTextLabel" not working anymore?

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

推荐答案

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

Try to change the style of the cell, use this code while initializing the cell

cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle 
                                   reuseIdentifier:CellIdentifier] autorelease];  

有关单元格样式的更多信息,请参见 Apple的类参考

For more information about the cell styles look at the apple's class reference

这篇关于UITableView detailTextLabel-iPhone开发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆