Chapter 6 ViewController

 

1. A  view controller’s view is not created until it needs to appear on the screen  . This optimization is called lazy loading, and it can conserve memory and improve performance.

 

~ programmatically, by overriding the UIViewController method loadView.

~ in Interface Builder, by loading a NIB file.)

 

 

 2. When  a view controller is created, its view property is nil, If a view controller is asked for its view and its view is nil, then  the view controller is sent the loadView message.

 

3. Setting a view controller as  the rootViewController adds that view controller’s view as a subview of the window (UIWindow’s setRootViewController:), It also automatically resizes the view to be the same size as the window.

 

 

4. When a view controller gets its view hierarchy by loading a NIB file, you do not override loadView.

 

5. UITabBarController allows user to swap between view controllers.

 

6. A local notification is a way for an application to alert the user even when the application is not currently running.

 

~ NSDate *date = [NSDate  date];

  UILocalNotification *note = [[UILocalNotification alloc] init];

  note.alertBody = @“Local notification”;

  note.fireDate = date;

  [[UIApplication shareApplication] scheduleLocalNotification:note];

 

原文地址:https://www.cnblogs.com/1oo1/p/3975467.html