开发者

adding a background image to UITabBarController

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"];
UIImageV开发者_运维百科iew* 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!


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:

Share background view between tabs on a UITabBarController

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜