0
我有一個tabBarController和我設置圖標,但我不能選擇未選定的圖標成功。它接縫我只選擇一個1圖標和選定的顏色,就是這樣。如何在選項卡欄中爲單個項目選擇2個圖標?
我如何拍攝一種顏色或爲未選定的狀態設置單獨的圖標? 我正在設置圖標和選定的圖標沒有成功。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Set the status bar to light style
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle: nil];
UITabBarController *tabBarController = (UITabBarController*)[mainStoryboard instantiateViewControllerWithIdentifier: @"TabBar"];
UITabBar *tabBar = tabBarController.tabBar;
NSLog(@"%@", tabBar.items);
UITabBarItem *tabBarItem1 = [tabBar.items objectAtIndex:0];
//UITabBarItem *tabBarItem2 = [tabBar.items objectAtIndex:1];
//UITabBarItem *tabBarItem3 = [tabBar.items objectAtIndex:2];
tabBarItem1.image = [UIImage imageNamed:@"IconTabBarFolder"];
tabBarItem1.selectedImage = [UIImage imageNamed:@"IconTabBarFolder:Highlighted"];
[[UITabBarItem appearance] setTitleTextAttributes:@{NSFontAttributeName : [UIFont fontWithName:@"HelveticaNeue-Medium" size:10.0f], NSForegroundColorAttributeName : [UIColor colorWithRed:.5 green:.5 blue:.5 alpha:1] } forState:UIControlStateNormal];
return YES;
}
不贊成使用,ios7! – Aleksandrenko
但它適用於iOS7。 –
使用不推薦使用的方法是不好的做法。 – Aleksandrenko