How to push Storyboard from loginviewcontroller wh

2019-08-23 04:31发布

I am having Loginview controller,I have created it with Xib and i want to push mainstoryboard on clicking loginbutton.

LoginViewController *lObjloginview = [[LoginViewController alloc] initWithNibName:@"LoginViewController" bundle:nil];
UINavigationController *lObjtempview = [[UINavigationController alloc] initWithRootViewController:lObjloginview];
self.window.rootViewController = lObjtempview;
[self.window makeKeyAndVisible];

This will add loginview from xib.but after pressing loginbutton I want to load storyboard.Can anyone help me in pushing mainstoryboard which has tabbar controller inside mainstoryboard to link xib.

1条回答
forever°为你锁心
2楼-- · 2019-08-23 05:14

Load the initial view controller from the storyboard and present it

UIStoryboard * storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
UIViewController * initialVC = [storyboard instantiateInitialViewController];
self.window.rootViewController = initialVC;

If you know a priori the class you're instantiating

UITabBarController * initialVC = (UITabBarController *)[storyboard instantiateInitialViewController];
查看更多
登录 后发表回答