2008년 4월 16일 수요일

objective c programming 1 - synthesize/dynamic

after declaring a variable within the interface
ex.
@interface MyClass: NSObject
{
    NSString *value;
}
@end

using a synthesize keyword within the implementation would provide a getter,setter for a simple "="

ex.
@implementation MyClass
@synthesize value;
@end

doing this you could set/get the value  like this
value = @"Hi";
or
NSString *sTmp = value;

also you can use the dynamic keyword to manually create a setter and getter
but in this case it would look like a conventional method

댓글 3개: