When are @property and @synthesize needed?

When do I need to add @property (nonatomic, retain) and @synthesize ? Also, when is an IBOutlet someObject enough? How can I set / get the UILabel value without @property and @synthesize? Does it depend on the type of user interface object?

And yes, I read similar questions about these 2 :)

0
source share
5 answers
+1
source

The pair ( @property , @synthesize ) will create the set/get methods used to access your ivars from other objects.

In a normal view controller, you do not need to define properties for your IBOutlets, since they usually should be accessed only by the view controller to which they belong.

+2
source

only required when you need access to member variables through objects of this particular class. If you want to change any label text at runtime, this is also access to the View Controller object, then you will only need to have a property defined for it, otherwise not.

Exit is just a connection between an object from xib and a member from a class. If you want to provide access to this element, although the record property of the object is for it, otherwise not.

Look this

+1
source

Not required if you do not want variables or objects to be accessed outside the class by other objects.

0
source

This link will help you - Properties In this link you should also read Atomicity and all the subheadings.

0
source

All Articles