Reputation: 367
Came across an SDK3.0 deprecation that I am having a bit of trouble trying to figure out. If my declaration of
@property (nonatomic, retain) UIImage *rowImage;
does not work, nor
@property (nonatomic, readonly, retain) UIImage *rowImage;
and I
@synthesize rowImage;
Do I need to write my own setter because @synthesize
will not properly handle this?
<hr>
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:RootViewControllerCell] autorelease];
// Dpericated in SDK 3.0 <br>
//<br>
//cell.text = controller.title;<br>
//cell.image = controller.rowImage;<br>
// Using what the documentation says to use
Error===> cell.textLabel = controller.title;<br>
Error===> cell.imageView = controller.rowImage;<br>
Error: Object cannot be set - Either readonly property or no setter found.
Hope this makes sense, any help would be appreciated.
Upvotes: 3
Views: 3430
Reputation: 367
Use the non-deprecated:
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:RootViewControllerCell] autorelease];
Then:
[[cell textLabel] setText:[controller title]]; <br>
[[cell imageView] setImage:[controller rowImage]];
Upvotes: 3
Reputation: 31
You can also use the usual .-syntax:
cell.textLabel.text = controller.title;
Upvotes: 3