在应用程序委托 didFinishLaunchingWithOptions 中设置选项卡栏视图控制器
这似乎是一件非常容易做的事情,但由于某种原因我无法弄清楚,而且我不太确定要问的正确关键字是什么。
我设置了标签栏,有 5 个标签栏项目。在我的应用程序委托中,我试图让中间的选项卡栏视图控制器成为要在 didFinishLaunchingWithOptions 中加载的视图控制器。现在左侧标签栏视图控制器正在加载。
我该怎么做?我可以在界面生成器中执行此操作,还是也可以以编程方式执行此操作?
谢谢!
this seems like a really easy thing to do, but for some reason I can't figure it out, and I'm not really sure what are the right keywords to ask.
I have tabbar set up, with 5 tabbar items. In my app delegate, I'm trying to get the middle tabbar viewcontroller to be the viewcontroller to load up in didFinishLaunchingWithOptions. Right now the left tabbar viewcontroller is loading up.
How would I do this? Is it something I can do in interface builder or can I do it programmatically too?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过在 didFinishLaunchingWithOptions 中添加以下行以编程方式执行此操作:
这假设“中间”指的是索引 2 处的对象(例如,在 tabBarController 中索引 0,1,2,3,4 处有对象)。
You can do this programmatically by adding the following line in didFinishLaunchingWithOptions:
This assumes that by "middle" you mean the one at index 2 (as in, you have objects at indices 0,1,2,3,4 in the tabBarController).