2011-12-17 14 views
1

カスタムTabBarカラーを使用したいと思います。それはOKだったが、iOSの中で、それは動作しません5.0.1のiOS 5ではカスタムTabBarカラーiOS 5.0.1

CGRect frame = CGRectMake(0, 0, 480, 49); 
UIView *view = [[UIView alloc] initWithFrame:frame]; 
UIImage *tabBarBG = [UIImage imageNamed:@"tabBar.png"]; 
UIColor *color = [[UIColor alloc] initWithPatternImage:tabBarBG]; 
[view setBackgroundColor:color]; 
[color release]; 

if ([[[UIDevice currentDevice] systemVersion] floatValue] > 4.9) { 

[self.tabBarController.tabBar insertSubview:view atIndex:1]; 
} 
else { 

[self.tabBarController.tabBar insertSubview:view atIndex:0]; 
} 

[view release]; 

:私は、次のコードを使用のiOS 5のリリースAfetr

iOS 5.0.1でTabBarの色を設定するにはどうすればよいですか?あなたがあるため、新たな外観のAPIのiOS5をして、それ以上そのトリックを必要としない

おかげ

答えて

0

。 iOS 5のタブバーでbackgroundImageやtintColorなどのプロパティを設定することができます。

if ([self.tabBarController.tabBar respondsToSelect:@selector(setBackgroundImage:)]) 
{ 
    self.tabBarController.tabBar.backgroundImage = someImage; 
} 
else 
{ 
    //use the old iOS4 subview hack 
} 
関連する問題