-(void)viewDidLoad
{
[super viewDidLoad];
TTTabItem *item = [[[TTTabItem alloc]initWithTitle:@"123"]autorelease];
TTTabItem *item1 = [[[TTTabItem alloc]initWithTitle:@"456"]autorelease];
TTTabItem *item2 = [[[TTTabItem alloc]initWithTitle:@"789"]autorelease];
TTTabItem *item3 = [[[TTTabItem alloc]initWithTitle:@"000"]autorelease];
TTTabBar *tabbar = [[TTTabBar alloc]init];
NSArray *array = [[NSArray alloc]initWithObjects:item,item1,item2,item3,nil];
[tabbar setTabItems:array];
tabbar.frame = CGRectMake(0, 0,320, 50);
[self.view addSubview:tabbar];
[tabbar release];
TTTabStrip *tabStrip = [[TTTabStrip alloc]init];
[tabStrip setTabItems:array];
tabStrip.frame = CGRectMake(0, 55, 320, 50);
[self.view addSubview:tabStrip];
[tabStrip release];
}
修改栏目滑动条的底色
.../three20/src/Three20Style/Sources/TTDefaultStyleSheet.m
- (TTStyle*)tabStrip {
UIColor* border = [TTSTYLEVAR(tabTintColor) multiplyHue:0 saturation:0 value:0.4];
return
[TTReflectiveFillStyle styleWithColor:TTSTYLEVAR(tabTintColor) next: //styleWithColor:RGBCOLOR( , , ) next:
[TTFourBorderStyle styleWithTop:nil right:nil bottom:border left:nil width:1 next:nil]];
}
修改栏目滑动条被选中标签的样式
.../three20/src/Three20Style/Sources/TTDefaultStyleSheet.m
- (TTStyle*)tabRound:(UIControlState)state {
if (state == UIControlStateSelected) {
return
[TTShapeStyle styleWithShape:[TTRoundedRectangleShape shapeWithRadius:TT_ROUNDED] next:
[TTInsetStyle styleWithInset:UIEdgeInsetsMake(9, 1, 8, 1) next:
[TTShadowStyle styleWithColor:RGBACOLOR(255,255,255,0.8) blur:0 offset:CGSizeMake(0, 1) next:
[TTReflectiveFillStyle styleWithColor:TTSTYLEVAR(tabBarTintColor) next: //styleWithColor:RGBCOLOR( , , ) next:
[TTInnerShadowStyle styleWithColor:RGBACOLOR(0,0,0,0.3) blur:1 offset:CGSizeMake(1, 1) next:
[TTInsetStyle styleWithInset:UIEdgeInsetsMake(-1, -1, -1, -1) next:
[TTBoxStyle styleWithPadding:UIEdgeInsetsMake(0, 10, 0, 10) next:
[TTTextStyle styleWithFont:[UIFont boldSystemFontOfSize:13] color:[UIColor whiteColor]
minimumFontSize:8 shadowColor:[UIColor colorWithWhite:0 alpha:0.5]
shadowOffset:CGSizeMake(0, -1) next:nil]]]]]]]];
} else {
return
[TTBoxStyle styleWithPadding:UIEdgeInsetsMake(0, 10, 0, 10) next:
[TTTextStyle styleWithFont:[UIFont boldSystemFontOfSize:13] color:self.linkTextColor
minimumFontSize:8 shadowColor:[UIColor colorWithWhite:1 alpha:0.9]
shadowOffset:CGSizeMake(0, -1) next:nil]];
}
} 修改栏目滑动条两侧的样式,以便与滑动条底色统一
.../three20/src/Three20Style/Sources/TTDefaultStyleSheet.m
- (TTStyle*)tabOverflowLeft {
UIImage* image = TTIMAGE(@"bundle://Three20.bundle/images/ overflowLeft.png");
TTImageStyle *style = [TTImageStyle styleWithImage:image next:nil]; style.contentMode = UIViewContentModeCenter; return style;
}
- (TTStyle*)tabOverflowRight {
UIImage* image = TTIMAGE(@"bundle://Three20.bundle/images/ overflowRight.png");
TTImageStyle *style = [TTImageStyle styleWithImage:image next:nil]; style.contentMode = UIViewContentModeCenter; return style;
}