Three20中TTTabbar和TTabStrip利用 (連載)入門

來源:互聯網
上載者:User
-(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; } 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.