Error in page 123 (init vs initWithFrame)


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.

  1. setRootViewController does nothing described in the book
  2. [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).
  3. [UIWindow makeKeyAndVisible] calls [UIWindow addRootViewControllerViewIfPossible] and this method sets the actual view’s frame.