Tutorial by Examples

Here is an example class which has a couple of instance variables, without using properties: @interface TestClass : NSObject { NSString *_someString; int _someInt; } -(NSString *)someString; -(void)setSomeString:(NSString *)newString; -(int)someInt; -(void)setSomeInt:(NSString *)...
The default property getters and setters can be overridden: @interface TestClass @property NSString *someString; @end @implementation TestClass // override the setter to print a message - (void)setSomeString:(NSString *)newString { NSLog(@"Setting someString to %@", newS...
This object, Shape has a property image that depends on numberOfSides and sideWidth. If either one of them is set, than the image has to be recalculated. But recalculation is presumably long, and only needs to be done once if both properties are set, so the Shape provides a way to set both propertie...

Page 1 of 1