跳转到主界面“UIStoryboard”

1、当用Main.storyboard搭建界面,滑动引导页后跳转到主界面,需要在Main.storyboard上设置Storyboard ID
如下图:
跳转到主界面“UIStoryboard”_第1张图片

代码如下:

//跳转到主界面“UIStoryboard”
        UIStoryboard *story = [UIStoryboard storyboardWithName:@"Main" bundle:nil];// Main是Main.sroryboard的的前缀名,Main是固定的
        UITabBarController * MainVc = [story instantiateViewControllerWithIdentifier:@"tabBar"];//在Main.sroryboard上设置“tabBar”,相当与给Main.sroryboard打标签,(Storyboard ID)
        UIWindow *getWindow = [UIApplication sharedApplication].keyWindow;
        getWindow.rootViewController = MainVc;
        MainVc.view.transform = CGAffineTransformMakeScale(0.1, 0.1);
        MainVc.view.transform = CGAffineTransformIdentity;

2、当点击按钮,跳转到Main.storyboard搭建到某个界面,代码如下(提供参考):

UIStoryboard *mainStory = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    [self.navigationController pushViewController:[mainStory instantiateViewControllerWithIdentifier:@"ManKe"] animated:YES];

在Main.storyboard上设置Storyboard ID如下图:
跳转到主界面“UIStoryboard”_第2张图片

你可能感兴趣的:(跳转到主界面“UIStoryboard”)