开发者

Sliding UITabBarItems in UITabBarController

开发者 https://www.devze.com 2023-03-20 21:44 出处:网络
I have a UITabBarController as my rootController with 8 UITabBarItems. and I want to s开发者_如何学JAVAhow just 4 UITabBarItems in my screen. By default all my other tab bar items appear in a small ta

I have a UITabBarController as my rootController with 8 UITabBarItems. and I want to s开发者_如何学JAVAhow just 4 UITabBarItems in my screen. By default all my other tab bar items appear in a small tabBarItem called "More" and you can select the other 4. But I have seen some apps that implement a sliding UITabBarItems with a slide icon instead of a "More" icon.

How can I show just 4 at a moment, and I slide the TabBarItems, and so that I can select the other tab bar items ?

~ Something like this ~

Sliding UITabBarItems in UITabBarController

And then I can slide to the next 4 sets by dragging

Sliding UITabBarItems in UITabBarController

It would be helpful if someone could point me in the right direction.


There is a nifty little github project that could help you... check it out: https://github.com/iosdeveloper/InfiniTabBar


This is not currently a built-in option for UITabBarContoller.

One way to approach the problem is to add a UIGestureRecognizer to the tabBar.view, and programmatically adjust which 4 options are available on the screen. You can add an animation to make it smooth or have a little bounce as it slides.


iPhone users are usually very picky and attached to Apple's UI Guidelines. Although you can pass the Apple verification, you probably wont be able to pass users' (meaning bad reviews and ratings). So I recommend you to re-consider your tabbar structure and use "..." More instead of sliding it... You can always override stuff in code, but then they wont work smooth with InterfaceBuilder and in the end you will have more trouble than you'd expect.

If you have similar tab items merge them and use maybe a segmented control or something to visually distinguish them. Or use a central navigation screen in which you can put 9 maybe more icons in a grid...

The first solution to your problem may not always be the best way. Well, it is very rare actually...


You have to write a custom control for this. I wrote one for showing a horizontal menu. You can probably modify that to fit your needs. http://blog.mugunthkumar.com/coding/ios-control-mkhorizmenu/

0

精彩评论

暂无评论...
验证码 换一张
取 消