1.storyboard
(1)
Here Bundle:nil equivalent to [NSBundle Mainbundle]
Secondviewcontroller *SECONDVC = [[Uistoryboard storyboardwithname:@ "Main" Bundle:nil] instantiateviewcontrollerwithidentifier:@ "Second"];
Secondviewcontroller *SECONDVC = [[Uistoryboard storyboardwithname:@ "Main" Bundle:[nsbundle MainBundle]] instantiateviewcontrollerwithidentifier:@ "Second"];
(2)
Secondviewcontroller *SECONDVC = [[Uistoryboard storyboardwithname:@ "SECONDSB" Bundle:nil] instantiateviewcontrollerwithidentifier:@ "Second"];
(3)
Secondviewcontroller *SECONDVC = [[Uistoryboard storyboardwithname:@ "SECONDSB" Bundle:nil] Instantiateinitialviewcontroller];
2. xib file with the same name as the controller secondviewcontroller.xib init or initwithnibname loaded
(1)
Secondviewcontroller *SECONDVC = [[Secondviewcontroller alloc]init];
(2)
Secondviewcontroller *SECONDVC = [[Secondviewcontroller alloc]initwithnibname:@ "Secondviewcontroller" Bundle:nil] ;
3. xib file with different name of controller View.xib loadnibnamed load Controller's View
/*
Specify the view to load Xib as controller when creating the controller, the name is irrelevant
> need to modify the Fileowner of the Xib file to associate
> Need to point the view inside the Fileowner to the view inside the Xib
*/
(1) Initwithnibname---Focus on file owner
Secondviewcontroller *SECONDVC = [[Secondviewcontroller alloc]initwithnibname:@ "Second" bundle:nil];
(2)
Secondviewcontroller *SECONDVC = [[Secondviewcontroller alloc]init];
Secondvc.view = [[[NSBundle mainbundle]loadnibnamed:@ "Secondviewcontroller" Owner:nil Options:nil] lastObject];
4. xib file with different name of controller delete view, create controller loadnibnamed---Focus on content in Xib
Secondviewcontroller *SECONDVC = [[[NSBundle mainbundle]loadnibnamed:@ ' SECONDVC ' Owner:nil Options:nil] lastObject] ;
Storyboard & XIB's own understanding