user916367
user916367

Reputation:

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 what the new method is

This is my code:

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

Upvotes: 1

Views: 2319

Answers (2)

Filip Radelic
Filip Radelic

Reputation: 26683

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.

Upvotes: 3

saintmac
saintmac

Reputation: 589

setText is indeed deprecated. Use textLabel setText instead:

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

Upvotes: 5

Related Questions