如何隐藏 tabBarController 的选项卡?
我想在 TabBarController 中创建一个选项卡,但我不想在 tabBar 上显示它...我的意思是它应该在那里但不可见...
就像我的 tabBarController 中有 5 个选项卡,我想要我的第五个选项卡只是看不见......
这可能吗?
I want to create a Tab in the TabBarController but i don't want to show that on the tabBar...i mean it should be there but invisible...
like I have 5 tabs in my tabBarController and I want that my fifth Tab only is invisible...
is this possible??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
无法隐藏单个选项卡。我想你可以给它一个空白图标,但你仍然会看到选项卡所在的空间。如果您有超过 5 个选项卡,您可以将此不可见选项卡安排在“更多...”选项卡项上,这样它就不会立即可见,但用户可以访问它。
如果您不希望用户能够访问它,人们必须首先想知道为什么要将它包含在选项卡栏控制器中。请记住:当您发现自己与这样的框架作斗争时,通常有更好的方法来完成您想要做的事情。
There's no way to hide an individual tab. You could give it a blank icon, I suppose, but you'd still see the space where the tab is. If you had more than 5 tabs, you could arrange for this invisible tab to be on the More... tab item, so it wouldn't be immediately visible but the user could access it.
If you don't want the user to be able to access it, one has to wonder why you want to include it in the tab bar controller in the first place. Rememeber: when you find yourself fighting against the framework like this, there's usually a much better way to do what you're trying to do.
事实并非如此,选项卡栏控制器的实现非常具体,因此它管理的任何视图控制器都可以通过某种方式从选项卡栏 UI 访问,无论是在栏本身上还是在“更多”部分中。你想实现什么目标?
Not really—the tab-bar controller is pretty specifically implemented so that any view controller it manages can be accessed from the tab-bar UI somehow, be it on the bar itself or in the “More” section. What are you trying to accomplish?