Search code examples
iosobjective-cios7ios8uitabbar

iOS 7 uitabbar shows, invisible on ios8


I have a previously existing app (pre ios8) that uses UITabbar. The tabbar is visible in ios7 simulator and device, but it is invisible in ios8. What is causing this issue? the space for the tab bar is there, but its background and text/images are not there. i've attached a pic of it.

iOS 7:

enter image description here

iOS 8:

ios 8


Solution

  • Even if setFinishedSelectedImage:withFinishedUnselectedImage: is deprecated in iOS7, it is working fine in iOS7 but not in 8.

    Use image and selectedImage property of UITabBarItem instead.

    I also had the same issue but my problem was different.

    Reference code:

        UITabBarItem *tabBarItem1 = [tabBar.items objectAtIndex:0];
    
        if ([self iOS7OrAbove])
        {
            //use UIImageRenderingModeAlwaysOriginal to set the custom image for ios 7 and above.
            tabBarItem1.selectedImage = [[UIImage imageNamed:@"SelectedImage"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
            tabBarItem1.image = [[UIImage imageNamed:@"UnselectedImage"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
        }
        else
        {
            [tabBarItem1 setFinishedSelectedImage:[UIImage imageNamed:@"SelectedImage"] withFinishedUnselectedImage:[UIImage imageNamed:@"UnselectedImage"]];
        }