开发者

SetText is Deprecated

开发者 https://www.devze.com 2023-03-31 20:08 出处:网络
Hi I am working out Xcode and Obj-C and I am getting this warning: Deprecations: \'setText:\' is deprecated

Hi I am working out Xcode and Obj-C and I am getting this warning:

Deprecations: 'setText:' is deprecated

I am wondering开发者_如何学JAVA what the new method is

This is my code:

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


setText is indeed deprecated. Use textLabel setText instead:

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


When you get a deprecated warning, just alt+click on the method or property that triggered it and you will get basic info about it from documentation inside a popover view, including a property or method you should use instead.

0

精彩评论

暂无评论...
验证码 换一张
取 消