2014-10-08 106 views
5

我有一個關於在屏幕的iOS應用中的頂部實現自定義的滾動標籤欄的問題。我正在尋找一個非常類似於vevo應用程序的標籤欄(如下圖所示)。我已經檢查了這個滾動標籤欄(https://github.com/vermontlawyer/JFATabBarController),但想要將其移動到頂部,並且它在編輯源代碼時似乎會出現毛病...我假設我不能使用標準tabbarcontroller,但是必須使自定義標籤欄....正確?我將如何去在屏幕頂部創建自定義滾動選項卡欄?定製滾動標籤欄

非常感謝您的任何反饋!

vevo tab screen 1 vevo tab screen 2

+0

你說這個控件是「毛刺」的。你看到什麼「毛刺」?我在運輸應用中使用了這個控件十個月,並沒有收到任何有關「毛刺」的投訴。 – 2014-10-18 16:21:44

回答

7

這個項目可以幫助你:https://github.com/Marxon13/M13InfiniteTabBar但你需要

在於內嵌有一個UIScrollView一個無限UITabBar;),它可以被配置爲把中的TabBar屏幕上方。

enter image description here

希望它能幫助!

+1

感謝您的反饋,這個例子看起來不錯! – user3708224 2014-10-08 16:11:42

+1

非常感謝您的反饋,看起來不錯! – user3708224 2014-10-08 16:14:52

+0

附加鏈接是不工作了:( – 2016-03-28 13:13:45

1

基本上,你會做類似如下:

@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 S,其標題,你會找回從dataSource。當一個按鈕被觸發時,你可以調用delegatecustomTabBar:activatedTabAtIndex:方法。代理方法觸發時,您的YourViewController將更改其內容。