Here is information what I know about variable properties
- atomic //default
- nonatomic
- strong=retain //default
- weak
- retain
- assign //default
- unsafe_unretained
- copy
- readonly
- readwrite //default
so below is the detailed article link where you can find above mentioned all attributes, that will defiantly help you.Many thanks to all the people who give best answers here!!
01.strong (iOS4 = retain ) - it says "keep this in the heap until I don't point to it anymore" - in other words " I'am the owner, you cannot dealloc this before aim fine with that same as retain" - You use strong only if you need to retain the object. - By default all instance variables and local variables are strong pointers. - We generally use strong for UIViewControllers (UI item's parents) - strong is used with ARC and it basically helps you , by not having to worry about the retain count of an object. ARC automatically releases it for you when you are done with it.Using the keyword strong means that you own the object.
Example:
@property (strong, nonatomic) ViewController *viewController;
@synthesize viewController;
02.weak (iOS4 = unsafe_unretained ) - it says "keep this as long as someone else points to it strongly" - the same thing as assign, no retain or release - A "weak" reference is a reference that you do not retain. - We generally use weak for IBOutlets (UIViewController's Childs).This works because the child object only needs to exist as long as the parent object does. - a weak reference is a reference that does not protect the referenced object from collection by a garbage collector. - Weak is essentially assign, a unretained property. Except the when the object is deallocated the weak pointer is automatically set to nil
Example :
@property (weak, nonatomic) IBOutlet UIButton *myButton;
@synthesize myButton;