Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a horizontal scrollable UITabBar in iOS?

Tags:

ios

iphone

ipad

The UITabBar in my app consists of 10+ items, but the width is enough to put all 10+ items.

How to make a horizontal scrollable UITabBar in iOS ?

Thanks.

like image 445
user403015 Avatar asked Dec 12 '11 23:12

user403015


2 Answers

You'll have to roll your own to at least some extent.

What might work, would be to create a UITabBar view (not the controller) and embedded it in a UIScrollView. You could then use that in place of your regular Tab Bar control by adding it to your TabBarController.view/tabBarView or something. Of course you'd have to play around to get it to look right, and I'm not sure if just setting the view to something wider will actually make it display more items or not.

Of course, for best results you'd probably want to do something entirely custom.

like image 191
axiixc Avatar answered Sep 16 '22 13:09

axiixc


From Apple's Developer Portal:

If you add more than five items to the viewControllers property, the tab bar controller automatically inserts a special view controller (called the More view controller) to handle the display of the additional items. Source

Seems like you will need to make a custom tab bar.

They also said this in the next paragraph:

Although the tab bar view is a key part of your tab bar interface, you do not modify that view directly. You might be breaking Apple's design guidelines by doing this.

like image 44
gurooj Avatar answered Sep 18 '22 13:09

gurooj