2013-10-10 5 views
10

में काम नहीं कर रहा है मैं आईओएस 7 में setSelectedImageTintColor करने की कोशिश कर रहा हूं, लेकिन यह काम नहीं कर रहा है। यहाँ कोड मैं didFinishLaunchingWithOptionssetSelectedImageTintColor आईओएस 7

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 में है कि यह अभी भी selectedImageTintColor प्रदर्शित नहीं होगा। चुने जाने पर यह सफेद है; अचयनित जब ग्रे। मैं क्या गलत कर रहा हूं?

उत्तर

15

यह आईओएस 7 में एक ज्ञात मुद्दा है। tintColor चयनित टैब छवि के लिए उपयोग किया जाता है। selectedImageTintColor पूरी तरह से अनदेखा किया जाता है। अचयनित टैब छवियों को टिंट करने का कोई तरीका नहीं है।

इस बारे में discussion on the Apple Developer Forums देखें।

कृपया bug report with Apple दर्ज करें।

+0

मुझे लगता है कि आप 'UIImageRenderingModeAlwaysOriginal' मोड के साथ 'UIImage' का उपयोग करके इसे हल कर सकते हैं। – frangulyan