标签:标签 控件 uitabbarcontroller block
UITabBarController * tab = [[UITabBarController alloc] init];
tab.delegate = self;
[tab setHidesBottomBarWhenPushed:NO];
NSArray * arr = [NSArray arrayWithObjects:nav,nav2,nav3,nav4,nav5,nav6, nil];
[tab setViewControllers:arr];
//整个一条的颜色
[tab.tabBar setBarTintColor:[UIColor whiteColor]];
//每个图标的颜色
[tab.tabBar setTintColor:[UIColor orangeColor]];
//无返回类型 无参数类型的block -(void)testFirstBlock { void (^myBlock)() = ^(){ NSLog(@"我输了>3<"); }; NSLog(@"比比谁先走"); myBlock(); } -(void)testSecondBlock { void (^twoBlock)(NSString *) = ^(NSString * str){ NSLog(@"str == %@",str); }; twoBlock(@"手拉手 一起走"); twoBlock(@"猪点点"); } //无返回值 多个参数 -(void)testThirdBlock { void (^thirdBlock)(NSString *,int) = ^(NSString * str,int a){ NSLog(@"int == %d,str == %@",a,str); }; thirdBlock(@"(?????)",55555); } //有返回值 有参数 -(void)testForthBlock { int (^forthBlock)(NSString *,NSInteger) = ^(NSString * value,NSInteger num){ int strValue = [value intValue]; return strValue+num; }; int d = forthBlock(@"77",2); NSLog(@"(?????)a == %d",d); } //改变背景颜色 -(void)testColorBlock { void (^myBlock)(UIColor *) = ^(UIColor * color){ [self.view setBackgroundColor:color]; }; self.teseBlock = myBlock; NSLog(@"textBlock == %@",self.teseBlock); }
标签:标签 控件 uitabbarcontroller block
原文地址:http://blog.csdn.net/somerain77/article/details/25002127