问题描述
我今天正在玩 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)