适用于iPhone的精美滚动标签栏。
要开始使用CCFScrollingTabBar,请下载源代码并检查示例项目。以下是我们在示例中所做的:
CCFScrollableTabView
。viewDidLoad
方法中,将可滚动标签视图的delegate
和dataSource
属性设置为我们自己。#pragma mark - CCFScrollableTabViewDataSource
- (UIColor *)textColorInScrollableTabView:(CCFScrollableTabView *)tabView {
return [UIColor whiteColor];
}
- (UIColor *)darkColorInScrollableTabView:(CCFScrollableTabView *)tabView {
return [UIColor colorWithRed:0.0706f green:0.1529f blue:0.4235f alpha:1.0f];
}
- (UIColor *)lightColorInScrollableTabView:(CCFScrollableTabView *)tabView {
return [UIColor colorWithRed:0.258f green:0.639f blue:0.890f alpha:1.0f];
}
- (NSArray *)titlesInScrollableTabView:(CCFScrollableTabView *)tabView {
return [NSArray arrayWithObjects:@"Afrikaans",@"Basque",@"Catalan",@"Croatian",@"Danish",@"English",@"French",@"German",@"Hungarian", nil];
}
#pragma mark - CCFScrollableTabViewDelegate
- (void)scrollableTabView:(CCFScrollableTabView *)tabView didSelectItemAtIndex:(NSInteger)index;
{
NSLog(@"%s - SELECTED = %d",__FUNCTION__,index);
NSString *language = Languages[index];
self.textLabel.text = LanguageTexts[language];
}
这样就完成了!