如何从作为 xib 的 loginviewcontroller 推送 Storyboard [英] How to push Storyboard from loginviewcontroller which is an xib

查看:28
本文介绍了如何从作为 xib 的 loginviewcontroller 推送 Storyboard的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 Loginview 控制器,我用 Xib 创建了它,我想在点击登录按钮时推送 mainstoryboard.

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];

这将添加来自xib的登录视图.但是在按下登录按钮后我想加载故事板.任何人都可以帮助我推动主故事板中的标签栏控制器来链接xib.

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.

推荐答案

从storyboard加载初始视图控制器并呈现

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];

这篇关于如何从作为 xib 的 loginviewcontroller 推送 Storyboard的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆