Failure of iPhone SDK 3.0 from UITableViewCell.text

Came to failure SDK3.0, which I experience with great difficulty, trying to understand. If my ad

@property (nonatomic, retain) UIImage *rowImage;

not working as well

@property (nonatomic, readonly, retain) UIImage *rowImage;

and I

@synthesize rowImage;

Do I need to write my own setter, because it @synthesizewill not handle this correctly?

<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.

+3
source share
2 answers

Use not obsolete:

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

Then:

[[cell textLabel] setText:[controller title]]; <br>
[[cell imageView] setImage:[controller rowImage]];
+3
source

You can also use the usual syntax:

cell.textLabel.text = controller.title;
+3
source

Source: https://habr.com/ru/post/1713605/


All Articles