Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Objective-C Pointers > pointing to properties

I have an NSInteger property of a custom class called 'estimatedTime', now, in my UITableView class I'm trying to pass this property as a pointer to a UITableViewCell. I can't seem to get it to work! I've tried the following:

NSInteger *pointer = sharedManager.tempTask.&estimatedTime;
NSInteger *pointer = &sharedManager.tempTask.estimatedTime;

I get the errors: lvalue required as unary '&' operand and: expected identifier before '&' token

Can you not pass a pointer to a property? Is the property not just it self pointing to the ivar in my custom class? I need it as a pointer type so I can edit the value when a UITextField is changed inside the UITableViewCell.

Thanks and hope it makes sense!

like image 968
Darthtong Avatar asked Dec 02 '22 03:12

Darthtong


1 Answers

Properties aren't variables; they are just syntactic sugar for get/set-style methods. Consequently, you can't take the address of a property.

like image 53
Marcelo Cantos Avatar answered Dec 15 '22 00:12

Marcelo Cantos