2013-10-10 11 views
10

iOS 7でsetSelectedImageTintColorを試していますが、動作しません。ここで私はそれはまだselectedImageTintColorは表示されませんdidFinishLaunchingWithOptionsiOS 7でsetSelectedImageTintColorが機能しない

UITabBarController *tabBarController = (UITabBarController *) self.window.rootViewController; 
UITabBar *tabBar = tabBarController.tabBar; 

for (UITabBarItem *item in tabBar.items) 
    { 
     UIImage *image = item.image; 
     UIImage *correctImage = [image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; 
     item.image = correctImage; 
    } 

[[UITabBar appearance] setTintColor:[UIColor whiteColor]]; 
[[UITabBar appearance] setSelectedImageTintColor:[UIColor colorWithRed:44.0/255.0 green:176.0/255.0 blue:28.0/255.0 alpha:1.0]]; 
[[UITabBar appearance] setBarTintColor:[UIColor colorWithRed:51.0/255.0 green:51.0/255.0 blue:51.0/255.0 alpha:1.0]]; 

の下で私のAppDelegate.mで持っているコードです。選択すると白です。選択されていない場合はグレーです。私は間違って何をしていますか?

答えて

15

これはiOS 7の既知の問題です。tintColorは、選択したタブ画像に使用されています。 selectedImageTintColorは完全に無視されます。選択されていないタブ画像に色を付ける方法はありません。

これについてはdiscussion on the Apple Developer Forumsを参照してください。

bug report with Appleを提出してください。

+0

私はあなたが 'UIImage'を' UIImageRenderingModeAlwaysOriginal'モードで使用することでこれを解決できると思います。 – frangulyan

関連する問題