故事板 - 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

Pop up dialog in Android home screen(在 Android 主屏幕中弹出对话框)
Android - Executing a custom listview in a custom dialog properly(Android - 在自定义对话框中正确执行自定义列表视图)
Suppressing Google Maps Intent Selection Dialog(禁止谷歌地图意图选择对话框)
Creating a custom dialog in Android(在 Android 中创建自定义对话框)
Dialog.show() vs. Activity.showDialog()(Dialog.show() 与 Activity.showDialog())
How to create dialog which will be full in horizontal dimension(如何创建将在水平维度上充满的对话框)