如何制作选项卡栏,使得选项卡栏的第一个选项卡不应保持选中状态
我创建了一个 Windows 应用程序。在我的 appdelegate
中,我调用了一个名为 analogcontroller 的控制器类,并将此类添加到我的窗口中,以便当我运行我的应用程序时,页面应该首先是此页面,其中包含一个模拟时钟,其中有五个 tabbaritems
,每个选项卡调用不同的类。
因此,在模拟控制器类 xib 中,我添加了一个包含 5 个 tabbaritems 的 tabbar
。但是当我运行我的应用程序时,打开的页面是第一个选项卡项目的页面,而不是analogcontroller。我希望当我运行我的应用程序时,我的模拟控制器 xib 应该被调用,并在其下面有 5 个选项卡栏项目,当我单击特定的选项卡项目时,只应打开其相应的页面,否则不应打开。这怎么可能?
I have created a Windows application.in my appdelegate
I have called a controller class named analogcontroller and added this class to my window so that when I run my application the page that should come first is this page that contains an analog clock with five tabbaritems
in it each calling different class.
So in the analog controller class xib I have added a tabbar
with 5 tabbaritems
in it. But when I run my application the page that gets opened is the page of the firsttabbaritem instead of analogcontroller. I want that when I run my application my xib of analog controller should be called with 5 tabbar items below it and when I click on particular tabbaritem then only its corresponding page should be opened, otherwise not. How is this possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以将选项卡选择索引设置为所需的选项卡索引,它从 0 开始
您可以编写类似 tabbarcontroller.tabbar.selectedindex =1; 的内容;
原谅语法错误...你应该尝试这个。 xCode 是丰富的编辑器。
you can set tabbar selected index to your desired tab index it starts from 0
you can write something like tabbarcontroller.tabbar.selectedindex =1;
Forgive syntax errors... you should try this. xCode is rich editor.
如果您有一个可见的 tabBarController,那么必然会选择某些内容。没有办法解决这个问题。
但是,如果您想隐藏 tabBar,那么您当然可以通过将其隐藏属性设置为 YES 或在所选选项卡(例如第一个 viewController)顶部显示模式视图来实现。
类似的问题此处
If you have a visible tabBarController, then something will necessarily be selected. No way around this.
However, if you would like to hide the tabBar, then you can certainly do that, either by setting its hidden property to YES or by presenting a modal view on top of the selected tab (e.g. the first viewController).
similar question here