顶部iOS上的自定义滚动标签栏

我有一个关于在iOS应用程序的屏幕顶部实现自定义滚动标签栏的问题。 我正在寻找一个非常类似于vevo应用程序的标签栏(如下图所示)。 我已经检查了这个滚动标签栏( https://github.com/vermontlawyer/JFATabBarController ),但想要将其移动到顶部,它似乎是我编辑源代码时的毛病…我假设我不能使用标准的tabbarcontroller这个,但必须使自定义标签栏….正确? 我将如何去创build一个自定义的滚动标签栏在屏幕的顶部?

非常感谢您的任何反馈!

vevo标签页面1vevo标签屏幕2

这个项目可能会帮助你: https : //github.com/Marxon13/M13InfiniteTabBar,但你需要

包含embeddedUIScrollView的无限UITabBar;),并且可以configuration将tabbar放在屏幕顶端。

在这里输入图像说明

希望能帮助到你!

基本上,你会做如下的事情:

@class CustomTabBar; @protocol CustomTabBarDatasource <NSObject> - (int)numberOfElementsInCustomTabBar:(CustomTabBar *)bar; - (NSString *)titleForTabAtIndex:(int)index inCustomTabBar:(CustomTabBar *)bar; @end @protocol CustomTabBarDelegate <NSObject> - (void)customTabBar:(CustomTabBar *)bar activatedTabAtIndex:(int)index; @end @interface CustomTabBar : UIView @property (weak) id<CustomTabBarDataSource> dataSource; @property (weak) id<CustomTabBarDelegate> delegate; @end @interface YourViewController : UIViewController { CustomTabBar *myTabBar; } @end @interface YourViewController (TabBarDataSource) <CustomTabBarDataSource> @end @interface YourViewController (TabBarDelegate) <CustomTabBarDelegate> @end 

您的CustomTabBar的实现将包括一个UIScrollView和一组UIButton ,其标题可以从dataSource检索。 当一个button被触发时,你会调用delegatecustomTabBar:activatedTabAtIndex:方法。 委托方法触发时, YourViewController将更改其内容。

你可以看看这个库: https : //github.com/raihan/ZRScrollableTabBar 。 这是简单和轻量级,可能会帮助你。

我正在寻找一个类似的解决scheme,但最终成为我自己的,并希望分享任何人可能在稍后看这个。

https://github.com/chrismanahan/Simple-Scrolling-Tab-Bar

这是一个超级简单的方法来创build滑动标签栏与标准UITabBarController在你的故事板。

    Interesting Posts