Graphics Programs Reference
In-Depth Information
Setting a view controller as the rootViewController of a window adds that view
controller's view as a subview of the window ( Figure 7.4 ). It also automatically resizes
the view to be the same size as the window. Given what you learned in Chapter 6 , you
could write setRootViewController: yourself:
- (void)setRootViewController:(UIViewController *)vc
{
// Get the view of the root view controller
UIView *rootView = [vc view];
// Make a frame that fits the window's bounds
CGRect viewFrame = [self bounds];
[rootView setFrame:viewFrame];
// Insert this view as window's subview
[self addSubview:rootView];
}
(This method does are a few more things, but this is what we are interested in right now).
Search WWH ::




Custom Search