简体   繁体   English

UITabBarController tabBar setItemWidth不起作用

[英]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.

相关问题 重置UITabBarController上的导航堆栈不起作用 - Resetting the navigation stack on a UITabBarController doesn't work 情节提要中的UITabBarController自定义类不起作用 - UITabBarController custom class in storyboard doesn't work TapGesture在tabBar下不起作用 - TapGesture doesn't work under tabBar 嵌入在UITabBarController中的UINavigationController呈现的视图未调整视图大小,以解决视图底部的tabBar - View presented by UINavigationController embedded in UITabBarController doesn't size view to account for tabBar at bottom of view iOS 7.1问题 - Tabbar调整大小不起作用 - iOS 7.1 issue - Tabbar resizing doesn't work 重置tabBar.isHidden在viewWillAppear中不起作用 - Reset tabBar.isHidden doesn't work in viewWillAppear 将Tabbar推入UITabBarController内部的ViewController时不会隐藏 - Tabbar won't hide when pushed into a ViewController inside a UITabBarController Uitabbarcontroller不会回应iPhone 5中标签栏的标题 - Uitabbarcontroller won't respond on touching on the title of the tabbar in iPhone 5 将AwesomeMenu与UITabBarController tabBar一起使用 - Using AwesomeMenu with a UITabBarController tabBar 当UITabBarController在屏幕上显示第一个选项卡时,调用什么方法? viewDidAppear不起作用 - What method is called when UITabBarController shows first tab on screen? viewDidAppear doesn't work
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM