不推荐使用单元格文本时出错的是什么?

时间:2012-06-01 07:44:29

标签: iphone cocoa-touch uitableview

int p = [indexPath indexAtPosition: [indexPath length] - 1];
[cell setText:[[array objectAtIndex: p] objectForKey: @"title"]];

我在这里找不到错误的原因。我正在做xml解析,只是想在tableview中显示内容,但程序没有运行,因为不推荐使用的错误弹出,我无法弄清楚原因。

2 个答案:

答案 0 :(得分:2)

您需要访问单元格的textLabel

cell.textLabel.text = [[array objectAtIndex: p] objectForKey: @"title"];

text上的旧UITableViewCell属性很久以前就已被弃用。

答案 1 :(得分:1)

使用此代码

Cell.textLabel.text=[array objectAtIndex: p] objectForKey: @"title"]];

不会弃用。