故事板 - UITabBarController

Storyboard - UITabBarController(故事板 - UITabBarController)
本文介绍了故事板 - UITabBarController的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我今天正在玩 iOS 5 和故事板.我目前拥有它,以便主要故事板以 uitabbarcontroller 开始,然后是 navigationviewcontroler,最后是 uiviewcontroller.一切正常.

I was playing around with iOS 5 and storyboards today. I currently have it so that the main storyboards starts with a uitabbarcontroller then a navigationviewcontroler and finally a uiviewcontroller. All that works fine.

我正在寻找的是如何在应用程序启动时动态设置 uitabbarcontroller 正在显示的 viewconotroller.所以我想使用 CoreData 来查看一个表是否为空,它是选择第二个视图控制器(标签栏项目 2),如果没有选择第一个视图控制器(标签栏项目 1).

What I'm looking for is how to dynamically set which viewconotroller the uitabbarcontroller is displaying when the application starts. So I'd want to use CoreData to see if a table was empty and it it was select the second viewcontroller (tabbar item 2) and if not select the first viewcontroller (tabbar item 1).

由于故事板正在处理正在显示的内容,我不确定如何在应用程序委托中进行设置?

Since the storyboard is handling what is being displayed, I wasn't sure how in the app delegate I could set this?

希望有人可以在这里为我指明正确的方向!

Hoping someone can point me in the right direction here!

谢谢!

推荐答案

您的应用程序委托将有一个窗口属性.这可用于获取指向情节提要的初始视图控制器(将是您的 UITabBarController)的指针,例如来自我的应用程序委托应用程序之一的此示例:didFinishLaunchingWithOptions:

Your app delegate will have a window property. That can be used to get a pointer to the storyboard's initial view controller (which will be your UITabBarController), like this example from one of my app delegates application:didFinishLaunchingWithOptions:

UITabBarController *tabController =
   (UITabBarController *)self.window.rootViewController;
tabController.selectedIndex =
   [defaults integerForKey:kOptionLastTabSelectedKey];
tabController.delegate = self;

这篇关于故事板 - UITabBarController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Why local notification is not firing for UNCalendarNotificationTrigger(为什么没有为UNCalendarNotificationTrigger触发本地通知)
iOS VoiceOver functionality changes with Bundle Identifier(IOS画外音功能随捆绑包标识符而变化)
tabbar middle tab out of tabbar corner(选项卡栏中间的选项卡角外)
Pushing UIViewController above UITabBar(将UIView控制器推送到UITabBar上方)
How can I sync two flatList scroll position in react native(如何在本机Reaction中同步两个平面列表滚动位置)
Get an event when UIBarButtonItem menu is displayed(显示UIBarButtonItem菜单时获取事件)