March 2012
Intermediate to advanced
590 pages
22h 48m
English
Each time we’ve added an instance variable to BNRItem, we’ve declared and implemented a pair of accessor methods. Now we’re going to see how to use properties instead. Properties are a convenient alternative to writing out accessors for instance variables – one that saves a lot of typing and makes your class files much clearer to read.
A property is declared in the interface of a class where methods are declared. A property declaration has the following form:
@property NSString *itemName;
When you declare a property, you are implicitly declaring a setter and a getter for the instance variable of the same name. So the above line of code is equivalent to the following:
- (void)setItemName:(NSString ...
Read now
Unlock full access