默认标签栏视图?
我环顾四周,找不到任何对 xCode 中选项卡栏控制器的默认选项卡的引用。我希望在应用程序加载时选择中间选项卡作为默认选项。有办法做到这一点吗?
我注意到人们正在做:
tabBarController.selectedIndex = 2;
我把这个放在哪里?我的 UITabBarController 没有与之关联的类文件,因为我使用情节提要来布局它。
I've had a look around and can't find any reference to default tab of a Tab Bar Controller in xCode. I would like the middle tab to be selected as the default when the app loads. Is there a way to do this?
I've noticed that people are sating to do:
tabBarController.selectedIndex = 2;
Where do I put this? My UITabBarController doesn't have a class file associated with it as I used storyboard to lay it out.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没有默认选项卡选项,您可以扩展 TabBarController 并创建一个在 init 上设置它的方法
,或者简单地在定义时您可以选择正确的选项卡
[tabBarController setSelectedIndex: 2]
There is not a default tab option you could extend the TabBarController and create a method that would set it on init
or simply when defined you can choose the correct tab
[tabBarController setSelectedIndex: 2]