views:

23

answers:

1

This is what I have from googling, but evidently it's not what I need:

- (void)applicationDidFinishLaunching:(UIApplication *)application 
{    
// add the tab bar controller to the window

[window addSubview:[tabBarController view]];

// load the image, create a view with the image

NSString* dirPath = [[NSBundle mainBundle] bundlePath];
NSString* imageFile = [dirPath stringByAppendingString:@"homebackground.png"];
UIImageView* view = [[UIImageView alloc] initWithImage: [UIImage imageNamed:imageFile]];

[[tabBarController tabBar] addSubview: view];
}

Yes, the image file loads fine..I think what the above does is attempt to change the bg of the navigation bar area of the tab bar? I'm not certain.

Does anyone know how I would go about changing the actual background with an image? Thank you!

+1  A: 

Try adding the image as the lowest layer explicitly via insertSubview:atIndex: using index 0.

Edit: There's an explicit setBackgroundImage category for UITabController in this thread:

http://stackoverflow.com/questions/2645666/share-background-view-between-tabs-on-a-uitabbarcontroller

Joost Schuur
The insertSubview:atIndex didn't do the trick for me, but that's a good discussion, thanks. I'm also thinking about just adding an image view in IB and setting a different image for each tab.