I have a question about implementing a custom scrollable tab bar at the top of the screen in an iOS app. I am looking for a a tab bar very similar to the vevo app (pictured
You can have a look at this library: https://github.com/raihan/ZRScrollableTabBar. Which is simple and lightweight and may help you.
this project may help you: https://github.com/Marxon13/M13InfiniteTabBar but you need
Consist in a infinite UITabBar with a UIScrollView embedded in it ;) and it can be configure to put the tabbar in top of screen.
Hope it helps!
I was looking for a similar solution, but ended up coming up with my own and wanted to share for anyone that might be looking at this later.
https://github.com/chrismanahan/Simple-Scrolling-Tab-Bar
It's a super simple way to create a sliding tab bar with the standard UITabBarController
in your storyboard.
Basically, you'd do something like the following:
@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
The implementation for your CustomTabBar
would include a UIScrollView
and a set of UIButton
s, whose title you would retrieve from the dataSource
. When a button is fired, you'd call the delegate
's customTabBar:activatedTabAtIndex:
method. Your YourViewController
would change its content when the delegate method fires.