改变uitabbar背景颜色

时间:2011-08-16 14:37:00

标签: iphone uitabbar

我正在编写此代码,但警告显示“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];

}

1 个答案:

答案 0 :(得分:1)

你试过吗

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

而不是addSubview:

来源:Changing Tint / Background color of UITabBar

相关问题