Step One: Manually initialize the storyboard.
First delete the three files that the system automatically created ViewController.h, VIEWCONTROLLER.M, and Main.storyboard.
2. Click on item-->general-->deployment Info to delete main in the main interface option.
3. Create a new Storyboard file, drag a controller, drag a button. Click the navigation bar above storyboard , and under title in the View Controller check box under the "Properties" tab, tick "is Initial View Controller".
4. Fill in the following code in the Didfinishlaunchingwithoptions method in the APPDELEGATE.M file:
-(BOOL) Application: (uiapplication *) application didfinishlaunchingwithoptions: ( Nsdictionary *) launchoptions {
1. Create a window
Self.window = [[UIWindow Alloc] initWithFrame:[UIScreen Mainscreen].Bounds];
2. Create Controller (A StoryBoard)
*story = [ uistoryboard Storyboardwithname: @ "Storyboard" Bundle: ];
2.1 Instantiate Controller (with Sweet (Jian tou))
uiviewcontroller *vc = [ story Instantiateinitialviewcontroller];
3. Set the window Root Controller
self. window . Rootviewcontroller = VC;
4. Put the window as the Main window and visible
[self. window makekeyandvisible];
return YES;
}
Step Two: Initialize the storyboard by token.
First delete the three files that the system automatically created ViewController.h, VIEWCONTROLLER.M, and Main.storyboard.
2. Click on item-->general-->deployment Info to delete main in the main interface option.
3. Create a new Storyboard file, drag a controller, drag a button. Click on the navigation bar above storyboard , and under the identity option in the left option of the "Properties" bar on the right, enter "Vstar" in the storyboard ID and click Enter.
4. Fill in the following code in the Didfinishlaunchingwithoptions method in the APPDELEGATE.M file:
-(BOOL) Application: (uiapplication *) application didfinishlaunchingwithoptions: ( Nsdictionary *) launchoptions {
1. Create a window
Self.window = [[UIWindow Alloc] initWithFrame:[UIScreen Mainscreen].Bounds];
2. Create Controller (A StoryBoard)
*story = [ uistoryboard Storyboardwithname: @ "Storyboard" Bundle: ];
2.1 Instantiate Controller (with Sweet (Jian tou))
uiviewcontroller *vc = [ story instantiateviewcontrollerwithidentifier:@ "Vstar" ];
3. Set the window Root Controller
self. window . Rootviewcontroller = VC;
4. Put the window as the Main window and visible
[self. window makekeyandvisible];
return YES;
}
Instantiate the controller with storyboard: