Search code examples
iphoneiosobjective-cuitabbaruiappearance

iOS styling UITabBar only works on simulator


I'm developing an iPhone app and I am trying to style a UITabBar: I need to set the background image and selection image of a tab bar.

This is the code I am using:

- (void)customizeInterface
{
    UIImage* tabBarBackground = [UIImage imageNamed:@"Tabbar"];
    [[UITabBar appearance] setBackgroundImage:tabBarBackground];
    [[UITabBar appearance] setSelectionIndicatorImage:[UIImage imageNamed:@"Selectiontab"]];
}

I am then calling

[self customizeInterface];

at the top of didFinishLaunchingwithOptions.

This works perfectly on the simulator, but on the device it doesn't work! On the device I get the usual black tabBar...anyone had similar issues?

Thanks.

EDIT:

SOLVED The problem was in the png image: for some reason the iPhone didn't like the image's compression...I edited the image in fireworks, saved it again as a png and now it works both on the sim and on the device :-)


Solution

  • SOLVED

    The problem was in the png image: for some reason the iPhone didn't like the image's compression...I edited the image in fireworks, saved it again as a png and now it works both on the sim and on the device :-)