views:

1073

answers:

4

In iPhoneOS, I want to create a UITabBarController for global app navigation (like the 'Phone' app and many others) whose tabbar items have text labels, but no icons.

I would therefore also like the height of the tabbar to be much shorter. The tabbar should only be tall enough to accomodate the text labels or Apple's minimum recommended button height [40px i believe].

Is there a standard way to say "this global tabbar has no icons, only text labels". If not, any advice on the best way to achieve this with a custom UITabBar subclass/replacement class?

+2  A: 

This sounds like the perfect task for a UIToolbar with a UISegmentedControl dropped in. It provides text-only tab behavior (though it might not have the appearance you're after...)

Collin Allen
+1  A: 

1) I'm not sure if you can modify the size of the tab bar of UITabBarController- I don't think that displaying just text will shrink the tab bar size for that you probably need to look at other solutions.

2) If you want to modify how the items in tab bar look, you have to set them on the UIViewController(s) that you add to UITabBarController. See tabBarItem of UIViewController

3) You can initialize UITabBaritem with system defaults (initWithTabBarSystemItem:tag: using UITabBarSystemItem) or using initWithTitle:image:tag:. In the latter case if image is nil it will not be displayed - so this should take care of text without an icon (I believe).

Look at tutorials regarding UIViewController or ViewControllers in general they will have discussion about UITabBarController.

stefanB
+1  A: 

Have you seen this in a good iPhone application? No? What a surprise! It's not what UITabBar is designed for, so you shouldn't do it.

If you're that desparate, you'll have to create your own UITabBar-style class and corresponding controller.

Mike Abdullah
A: 

I have seen this done in at least one app by creating icons with the desired text in each. Then just add the icons with the text as if they were the regular images.

Jonah