Chapter 4 - viewDidLoad versus loadView
Hi all,
I'm currently working my way through the book using XCode 4. So far so good, but I do have a question now.
In the How it works explanation of the example on page 95 the author writes that you need to override the viewDidLoad method to programmatically create your view during runtime.
However in the example in chapter 3 on dynamically adding views he overrides the loadView method to build up the user interface.
Now I tried doing the same thing in this project. So instead of using viewDidLoad (works) I implement loadView. In that case I get a EXC_BAD_ACCESS error on this line: button.frame = frame;
When I add a call to the superclass in the first line of loadView, like this: [super loadView]; I no longer receive this error, but the author doesn't use this in the chapter 3 example. So my question is: what's the difference between those two methods and why does the author pick one over the other in those two examples?
Ruben.
|