IOS8 - does not display custom images in the tab
I have a pre-existing app (pre iOS8) that uses a UITabbar with a custom image. Tabba is visible in iOS7 simulator and device, but not visible in iOS8. What is causing this problem? I use image
and selectedImage
properties UITabBarItem
with UIImageRenderingModeAlwaysOriginal
images. Is it an issue with the Xcode 6 or iOS (iPhone) simulator, or are we unable to use custom images (only grayscale images are allowed !?) on the tab anymore? link for image property tabbaritem
- iOS7:
- iOS8:
source to share
Problem with my approach when initializing tab items (in method when login is completed on the login screen itself). I have a login validation login at the login screen viewDidLoad and segueing to the main screen if the user is logged in. But in the viewWillAppear of the login, I return tabbarItems.
In the iOS 8 pre-login window, the screen is not showing and I have an initialized tab on my home screen. But in iOS 8, it displays the login screen (for a while) even if I go to the main screen from viewDidLoad.
To solve the problem, I moved the initialization code for the tab items to the home screen.
source to share
Let's say you have an array of images in your project:
NSArray *icons_low = [[NSArray alloc]init];
icons_low = [NSArray arrayWithObjects:@"first_tab_ic.png", @"second_tab_ic.png", @"third_tab_ic.png", @"4th_tab_ic.png", nil];
for(int i=0;i<icons_low.count;i++) {
UITabBarItem *item = [self.tabBarController.tabBar.items objectAtIndex:i];
NSString *img_name = [NSString stringWithFormat:@"%@", [icons_low objectAtIndex:i] ];
/* deprecated -> comment such lines
[item setFinishedSelectedImage:[UIImage imageNamed:img_name] withFinishedUnselectedImage:
[UIImage imageNamed:img_name]]; */
item.image = [[UIImage imageNamed:img_name]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal ];
item.selectedImage = [[UIImage imageNamed:img_name]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
}
But I also suspect that your tablet (check the XIB) has set something related to setBarStyle.
source to share