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. So 4 items show up on the bottom and a "more" item that shows the other two items when clicked.

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. How can I resize the width of each item?

An Image is attached if I wasn't clear enough, thanks in advance.

enter image description here

2 Answers2

2

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. You should check cocoacontrols.com and github, I'm sure something already exists to accomplish this, or at least something you can easily modify.

Ben Baron
  • 14,496
  • 12
  • 55
  • 65
1

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.

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. That's an easy and fast way, and your app will not be rejected.

A-Live
  • 8,904
  • 2
  • 39
  • 74
  • If you're going that far, you might as well just scrap the UITabBarController altogether and use something built from scratch for this purpose. You would be using the controller in a way it wasn't meant to be used which is just asking for trouble in a future iOS update. If you skip implementing the more tab, the UITabBarController is actually pretty simple to rewrite and have full control over and there are already a bunch of custom implementations out there (mostly for skinning purposes). – Ben Baron May 25 '12 at 23:11
  • @einsteinx2 the main drawback is that eventually you will say "Ok, let's have the more button", then you look into the code with a custom view-controller and say "Oops, i need to go to SO and ask, how do i make a more button". With a tabBarController that is only one code-line. The compatibility level is very high and you can expect the tabBarController to be effective and to be improved for you later just for free. I'd stay with this solution. – A-Live May 25 '12 at 23:18