[英]UITabBarController tabBar setItemWidth doesn't work
I have six tabs and need to show them all without More button. 我有六个标签,需要在没有更多按钮的情况下显示所有标签。 jomafer answer says that
setItemWidth
does that. jomafer回答说
setItemWidth
就是setItemWidth
。 I called this in AppDelegate
but it didn't work. 我在
AppDelegate
调用了它,但它没有用。
[[UITabBar appearance] setItemWidth:self.window.frame.size.width/6];
I then called the above in TabBarController
viewDidLoad
but it still didn't work. 然后我在
TabBarController
viewDidLoad
调用了上面的内容,但它仍然无效。
Even tried 甚至尝试过
[self.tabBar setItemWidth:self.window.frame.size.width/6];
But there are few like this which say that what I want is not possible using UITabBar
. 但很少有这样的人说使用
UITabBar
我想要的东西是不可能的。 Is this true? 这是真的?
UITabBar does not support more than 5 items without the "more" button. 没有“更多”按钮,UITabBar不支持超过5个项目。
Do you really need 6 buttons at the bottom of the screen? 你真的需要屏幕底部的6个按钮吗? They're going to be small targets.
他们将成为小目标。 Consider rethinking your workflow if you have 6 buttons you'll need to constantly access.
如果您有6个按钮需要经常访问,请考虑重新考虑您的工作流程。
If you definitely need 6, just subclass UITabBar - I'm pretty sure you just need to override layoutSubviews and change a 5 to a 6 somewhere. 如果你肯定需要6,只需要UITabBar的子类 - 我很确定你只需要覆盖layoutSubviews并在某处更改5到6。
There's also an existing UITabBar replacement project called Infinite Tab Bar that might fit your needs, if you don't necessarily need all 6 buttons visible at all times. 还有被称为现有UITabBar更换项目无限标签栏可能会满足您的需求,如果你并不一定需要所有6个按钮,在任何时候都可见。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.