views:

1043

answers:

2

Came across an SDK3.0 deprecation that I am having a bit of trouble tryinig 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?


cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:RootViewControllerCell] autorelease];

// Dpericated in SDK 3.0
//
//cell.text = controller.title;
//cell.image = controller.rowImage;

// Using what the documentation says to use Error===> cell.textLabel = controller.title;
Error===> cell.imageView = controller.rowImage;

Error: Object cannot be set - Either readonly property or no setter found.

Hope this makes sense, any help would be appreciated.

+1  A: 

Use the non-deprecated:

cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:RootViewControllerCell] autorelease];

Then:

[[cell textLabel] setText:[controller title]];
[[cell imageView] setImage:[controller rowImage]];

djt9000
With much thanks to BrianSlick
djt9000
A: 

You can also use the usual .-syntax:

cell.textLabel.text = controller.title;
meDoThis