-(Instancetype) Initwithnibname: (NSString *) Nibnameornil Bundle: (NSBundle *) Nibbundleornilviewdidloadviewwillappearviewwilldisapppear
"iOS Programming" P137
The initialization code about the view cannot be written on the initialization of the View controller (1) for the following reasons: In order to implement view lazy loading, you should not access view or view sub-views in Initwithnibname:bundle: But should be placed in viewdidload;
Viewdidload: This method is used to confirm that the view has been loaded and that the method is called after the view controller has loaded the nib file;
Viewwillappear: This method will be called before the view controller is added to the application window;
The difference between the two methods is that if you only need to set the View object once after startup, select Viewdidload, and if the user needs to set it each time they see the view controller, select Viewwillappear;
Viewdidload, Viewwillappear, viewwilldisappear