简体   繁体   English

更改 uitabbar 背景颜色

[英]change uitabbar background color

I am write this code but the warning is show "insertSubview" may not respond我正在编写此代码,但警告显示“insertSubview”可能没有响应

- (void)viewDidLoad {

    [super viewDidLoad]; 

    CGRect frame = CGRectMake(0, 0, 480, 49);

    UIView *v = [[UIView alloc] initWithFrame:frame];

    UIImage *i = [UIImage imageNamed:@"GO-21-TabBarColorx49.png"];

    UIColor *c = [[UIColor alloc] initWithPatternImage:i];

    v.backgroundColor = c;

    [c release];

    [[self tabBar] addSubview:v];

    [v release];

}

Did you try你试过了吗

[[self tabBar] insertSubview:v atIndex:0];

Instead of addSubview:而不是addSubview:

Source: Changing Tint / Background color of UITabBar来源: 更改 UITabBar 的色调/背景颜色

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM