简体   繁体   English

如何调整Xcode 4.3.1中的标签栏项目的大小?

[英]How do I resize the tab bar items in Xcode 4.3.1?

I've been searching on how to resize the tab bar items on the "Tab Bar Controller," but obviously couldn't find anything. 我一直在搜索如何调整“标签栏控制器”上的标签栏项目,但显然找不到任何东西。

The reason why I want to do this is because I have exactly 6 items, and it causes the "more" item to be created whenever you have 6 or more. 我想要这样做的原因是因为我有6个项目,只要你有6个或更多,它就会导致创建“更多”项目。 So 4 items show up on the bottom and a "more" item that shows the other two items when clicked. 因此,底部显示4个项目,单击时显示另外两个项目的“更多”项目。

My title for all my items are short, so I want to squeeze 6 of them right below without the "more" and the only way to do that is to shrink the items width. 我所有项目的标题都很短,所以我想在没有“更多”的情况下在下方挤出其中的6个,唯一的方法是缩小项目宽度。 How can I resize the width of each item? 如何调整每个项目的宽度?

An Image is attached if I wasn't clear enough, thanks in advance. 如果我不够清楚,请附上图片,提前感谢。

在此输入图像描述

The UITabBarController does not support much customizing, so you'll either need to write your own or use one that has already been written by someone else for a similar purpose. UITabBarController不支持太多自定义,因此您需要自己编写或使用已由其他人编写的用于类似目的的自定义。 You should check cocoacontrols.com and github, I'm sure something already exists to accomplish this, or at least something you can easily modify. 您应该检查cocoacontrols.com和github,我确信已经存在一些事情来实现这一目标,或者至少可以轻松修改一些内容。

Even if you were able to subclass a TabBar and change it's behavior, you'll likely have to override it's internal methods and it's hard to estimate the required time. 即使你能够对TabBar进行子类化并改变它的行为,你也可能必须覆盖它的内部方法,并且很难估计所需的时间。

To meet your requirements, i would hide the tab bar and display another control instead (probably a segmented control) passing it's selection events to the used tabBarController. 为了满足您的要求,我会隐藏标签栏并显示另一个控件(可能是分段控件)将其选择事件传递给使用过的tabBarController。 That's an easy and fast way, and your app will not be rejected. 这是一种简单快捷的方式,您的应用不会被拒绝。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM