Three20中TTTabbar和TTabStrip利用 (连载)入门

-(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; 

} 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值