2013-10-10 2 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

관련 문제