我在我的應用程序動態地添加一個選項卡欄,如下所示: -更改定製的標籤欄的顏色在iphone
if (isLogin == TRUE) {
rootController = [[SettingsViewController alloc] init];
tabTitle = @"Settings";
navTitle = @"Settings";
tabImage = [UIImage imageNamed:@"icon1.png"];
}
else
{
root =TRUE;
rootController = [[RootViewController alloc] init];
tabTitle = @"Home";
navTitle = @"Login";
tabImage = [UIImage imageNamed:@"icon1.png"];
}
break;
case 1:
rootController = [[AboutUs alloc] init];
tabTitle = @"AboutUs";
navTitle = @"AboutUs";
tabImage = [UIImage imageNamed:@"icon2.png"];
break;
case 2:
rootController = [[ContactUsViewController alloc] init];
tabTitle = @"Contact Us";
navTitle = @"Contact Us";
tabImage = [UIImage imageNamed:@"icon3.png"];
break;
case 3:
rootController = [[MoreViewController alloc] init];
tabTitle = @"More";
navTitle = @"More";
tabImage = [UIImage imageNamed:@"icon4.png"];
break;
rootController.view.hidden = FALSE;
UINavigationController *subController = [[UINavigationController alloc]
initWithRootViewController:rootController];
subController.navigationBar.tintColor = [UIColor colorWithRed:(110.0/255.0) green:(184.0/255.0) blue:(71.0/255.0) alpha:1.0];
subController.navigationBar.topItem.title = navTitle;
subController.title = tabTitle;
subController.navigationItem.hidesBackButton =YES;
subController.tabBarItem.image = tabImage;
NSLog(@"%@",subController);
[controllers addObject:subController];
NSLog(@"%@",controllers);
[subController release];
[rootController release];
因此,它被示出作爲以下形式的標籤: -
但我想cutomise默認檢測到標籤欄(藍色)的顏色爲橙色,並希望標籤欄看起來像這樣: -
請幫幫我;我怎樣才能做到這一點?
你應該接受的Rahul Vyas說答案 – Legolas