0

次のコードを使用して UITabbar をカスタマイズしようとしていますが、うまくいきません。

これは私のviewDidLoadメソッドにあります

 UIImage *tabBackground = [[UIImage imageNamed:@"tabbar.png"]
                              resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
    // Set background for all UITabBars
    [[UITabBar appearance] setBackgroundImage:tabBackground];
    // Set background for only this UITabBar
    [[self.tabBarController tabBar] setBackgroundImage:tabBackground];

ここでどこが間違っているのでしょうか?ありがとう

4

1 に答える 1

1

UITabBar コントローラーの背景色を変更できます。以下のコードを参照してください。

   tabBar1.backgroundColor = [UIColor clearColor];
   CGRect frame = CGRectMake(0, 0, 480, 49);
   UIView *view = [[UIView alloc] initWithFrame:frame];
   UIImage *image = [UIImage imageNamed:@"Image.png"];
   UIColor *color = [[UIColor alloc] initWithPatternImage:image];
   view.backgroundColor = color;
   [color release];
   [[self tabBar] insertSubview:view atIndex:0];
   [view release];
于 2012-12-07T07:45:37.140 に答える