When we create view using initWithFrame: we supply a valid frame struct, but in page 122 controller creates view using init method. Who sets the frame? Page 123 states that setRootViewController both triggers the view creation and also sets the frame. Looking at call stacks in debuggers I figured out that the process is different.
- setRootViewController does nothing described in the book
- [UIWindow makeKeyAndVisible] calls [UIWindow loadViewIfRequired] which in turn calls [viewController loadView] which creates view and call it’s [UIView init] which results in view with frame (0,0).
- [UIWindow makeKeyAndVisible] calls [UIWindow addRootViewControllerViewIfPossible] and this method sets the actual view’s frame.