(a) Four ways to create a controller
(1) SB//transmission NIU is equivalent to [NSBundle Mainbundle];Uistoryboard *SB = [Uistoryboard storyboardwithname:@"Mystoryboard"Bundle:nil]; Self.window.rootViewController=[SB Instantiateinitialviewcontroller]; (2) sb+Reusable Signage Uistoryboard*SB = [Uistoryboard storyboardwithname:@"Mystoryboard"Bundle:nil]; Uiviewcontroller*control = [SB instantiateviewcontrollerwithidentifier:@"MYSB"]; (3) xib:xib requires an output port Myviewcontroller*con = [[Myviewcontroller alloc] Initwithnibname:@"Myviewcontroller"Bundle:nil]; Self.window.rootViewController=con; (4) Pure Code
(ii) The controller's view is created in a variety of ways only the view default created by SB is white and can be changed at will. If you create a view through code, the style is blank. If the Xib and controller name are the same, then the controller directly alloc init out is xib. (1) Pure code creation: it's black.
// 1. Pure Code Self.window = [[UIWindow alloc] Initwithframe:[uiscreen mainscreen].bounds]; = [Uicolor clearcolor]; = [[Viewcontroller alloc] init];
(2) SB Create: Is white, color to see your mood (3) Xib create to see the controller name and Xib name. If the controller is Myviewcontroller, then My,myviewcontroller, other ... The priority is reduced in descending order. (4) Call the Loadview method in the controller: the highest priority. When you rewrite it, you don't write anything, it turns black. (iii) Controller creation process: The controller's view is time-delayed loaded.
11.09 multiple ways to create a controller and create a view