Tuesday, September 6, 2011

Difference Between @synthesize and @dynamic

//@synthesize will generate getter and setter methods for your property. @dynamic just tells the compiler that the getter and setter methods are implemented not by the class itself but somewhere else (like the superclass)

//@dynamic e.g. with subclasses of NSManagedObject (CoreData) or when you want to create an outlet for a property defined by a superclass that was not defined as an outlet:



//Super class:

@property (nonatomic, retain) NSButton *someButton;

@synthesize someButton;



//Subclass:

@property (nonatomic, retain) IBOutlet NSButton *someButton;

@dynamic someButton;

No comments:

Post a Comment

Kamleshwar