如何控制tabbarview控制器?
我有一个问题,在我的 tabbarviewcontroller
中,特定选项卡按钮中有许多 viewcontroller
。我希望当我按下选项卡按钮时,它应该首先出现 viewcontroller< /code> 涉及该选项卡按钮,而不是该选项卡按钮的当前
viewcontroller
。请有人帮助我。
I've a problem that in my tabbarviewcontroller
there are many viewcontroller
in a particular tab button.I want that when I press tab button it should come first viewcontroller
regarding that tab button not the current viewcontroller
of that tab button. please some one help me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你无法控制这一点。当您再次点击该按钮时,TabBarController 将始终显示与该 tabBarButtonItem 对应的 rootViewController。
编辑
然后阅读 TabBar Delegate 方法,例如 tabbar didSelectItem 类似的东西。像 appDelegate 中一样实现该委托方法,然后您可以随时在点击该按钮索引时检查 show view1 。这是方法。您可以获取索引并弹出 view2,以便始终显示 view1。
You cannot control this. TabBarController will always show the rootViewController corresponding to that tabBarButtonItem when you tapped the button again.
EDIT
Then read TabBar Delegate methods like tabbar didSelectItem it's something like that. Implement that delegate method like in appDelegate and then you can always check show view1 when that button index is tapped. Here is the method. You can get the index and pop the view2 so it will always view1 displayed.