In the text it states that setRootViewController method is implemented by UIWindow. However, when I search the Apple documentation I can’t find it anywhere except in sample code. Is the Apple documentation incomplete or did I miss something?
That’s a great question. And you are correct in that if you do a search for the text “setRootViewController” you will not find anything. However, if you look at the documentation for UIWindow you will see that there is a property called rootViewController. When you create a property using the built in @property tool it automatically constructs a “setter” and “getter” for you. The setter will follow the setvariableName naming convention. because of this, if you type:
@property(nonatomic,retain) UIViewController *rootViewController;
in your interface file (.h), the compiler actually inserts the appropriate code for two methods:
the first one sets, the second one gets.
i hope that helps. please feel free to post again, or PM me if you have more questions.
Many thanks. After I posted this question, I found chapter 3 again, where getters and setters are explained. somehow I hadn’t made the connection!