[英]UITabBarController delegate with storyboard
我知道如果我有以tabBar开头的rootViewController我可以像这样创建UITabBar:
UITabBarController *tabController = (UITabBarController *)self.window.rootViewController;
tabController.selectedIndex = [defaults integerForKey:kOptionLastTabSelectedKey];
tabController.delegate = self;
但我的问题是:如果tabBar不是我的rootView,我如何创建tabBar? 我的应用程序以简单的viewController登录开始,登录后将出现tabBar。 其次,我应该在appDelegate或其他地方创建标签栏?
谢谢!!!
我认为你应该使你的tabBarController成为你的窗口的rootViewController,而不是通过窗口rootViewController模拟地呈现你的loginViewController,登录后你可以解除loginViewController。检查以下代码。
[self.window.rootViewController presentModalViewController:loginViewController animated:YES];
并在登录后使用委托方法或在loginViewController类中编写以下代码并解除loginViewController。
[self.window.rootViewController dismissModalViewControllerAnimated:YES];
要么
[self dismissModalViewControllerAnimated:YES];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.