SetText已弃用

时间:2011-08-28 11:36:04

标签: objective-c ios xcode xcode4

您好我正在制作Xcode和Obj-C,我收到了这个警告:

  

弃用:'setText:'已弃用

我想知道新方法是什么

这是我的代码:

[cell setText:[NSString stringWithFormat:@"I am cell %d", indexPath.row]];

2 个答案:

答案 0 :(得分:6)

setText确实已被弃用。请改用textLabel setText:

cell.textLabel.text = [NSString stringWithFormat:@"I am cell %d", indexPath.row];

答案 1 :(得分:3)

当您收到已弃用的警告时,只需按住alt并单击触发它的方法或属性,您就可以从弹出视图中的文档中获取有关它的基本信息,包括您应该使用的属性或方法。