2014年7月8日 星期二

ios7 Storyboard UIViewController(first ViewController,root ViewController)



取消 Is Initial View Controller 的勾勾


設定Storyboard ID



刪除 Main Interface 內的文字


程式啟動時第一個 UIViewController welcomeStoryboard

// in AppDelegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds];
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    UIViewController *firstViewController = [storyboard instantiateViewControllerWithIdentifier:@"welcomeStoryboard"];
    self.window.rootViewController = firstViewController;
    [self.window makeKeyAndVisible];
    return YES;

}

後續想轉跳的UIViewController myStoryboard

// in ViewController.m

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *view = [storyboard instantiateViewControllerWithIdentifier:@"myStoryboard"];
[view setModalPresentationStyle:UIModalPresentationFullScreen];
[self presentViewController:view animated:NO completion:nil];