1.空工程中通過創建storyboard文件加載頁面
//獲取Main.storyboard
UIStoryboard
*mainStory = [UIStoryboard
storyboardWithName:@"Main"
bundle:nil];
//獲取Main.storyboard中的第2個視圖
SecondViewController
*secondController = [mainStory
instantiateViewControllerWithIdentifier:@"SecondStory"];
//設置窗體的根視圖為Storyboard裡的視圖
self.window.rootViewController
= secondController
StoryBoard的ID在這裡設置:
2. 其他控制器中設置StoryBoard的初始控制器為window的根控制器
UIStZ喎?/kf/ware/vc/" target="_blank" class="keylink">vcnlib2FyZCAqc3RvdHliID0gW1VJU3Rvcnlib2FyZCBzdG9yeWJvYXJkV2l0aE5hbWU6QA=="Second" bundle:nil]; [self.view.window setRootViewController:stotyb.instantiateInitialViewController];3.跳轉到Storyboard中某個控制器
//獲取Main.storyboard
UIStoryboard
*mainStory = [UIStoryboard
storyboardWithName:@"Main"
bundle:nil];
//獲取Main.storyboard中的第2個視圖
SecondViewController
*secondController = [mainStory
instantiateViewControllerWithIdentifier:@"SecondStory"];
//跳轉頁面