UITabBar not showing selected item images in ios 7

后端 未结 20 1886
我在风中等你
我在风中等你 2020-11-29 18:36

The icons show fine in ios 6 but not in ios 7. I\'m setting the selected state in the viewController viewDidLoad method. When the user selects a tab bar item the image disap

20条回答
  •  一个人的身影
    2020-11-29 19:08

    You should write to the function:

    UIImage* tab_image = [UIImage imageNamed:@"tab_image.png"];
    UIImage* tab_image_selected = [UIImage imageNamed:@"tab_image_selected.png"];
    
    tab_image = [tab_image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    tab_image_selected = [tab_image_selected imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    
    self.tabBarItem.image = tab_image;
    self.tabBarItem.selectedImage = tab_image_selected;
    

    I hope this helps

提交回复
热议问题