我创立了一个UITab BarController Addition类别,允许你这样做。 牢记所选的《国际调查评论》管理员需要透明,以便了解背景形象。
/UITab BarController+CC Additions.h
@interface UITabBarController (CCAdditions)
- (void) setBackgroundImage:(UIImage *)i;
@end
页: 1
#import "UITabBarController+CCAdditions.h"
@implementation UITabBarController (CCAdditions)
- (void) setBackgroundImage:(UIImage *)i {
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,320,480)];
imageView.backgroundColor = [UIColor colorWithPatternImage:i];
[[self view] addSubview:imageView];
[[self view] sendSubviewToBack:imageView];
[[self view] setOpaque:NO];
[[self view] setBackgroundColor:[UIColor clearColor]];
[imageView release];
}
@end
a a
#import "UITabBarController+CCAdditions.h"
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[tabBarController setBackgroundImage:[UIImage imageNamed:@"icon.png"]];
[tabBarController.view setNeedsDisplay];
return YES;
}
我使用色人种,而不是背景 图像,因为它允许在必要时使用