3
,有UI外觀,是否可以刪除漸變簡單的方法?如何刪除iOS 5中的UITabbaritem的漸變/陰影效果,iOS 5中的
我這樣做來定製我的tabbar,可以做些什麼來刪除漸變?
感謝閱讀
-(void)UIAppearances
{
//set the background of tab bar
UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"navbar_bgrd.png"]];
if ([[[UIDevice currentDevice] systemVersion] floatValue] > 4.9) {
//iOS 5
//[self.tabBarController.tabBar insertSubview:imageView atIndex:1];
[[UITabBar appearance] setBackgroundImage:[UIImage imageNamed:@"navbar_bgrd.png"]];
[[UITabBar appearance] setSelectionIndicatorImage:
[UIImage imageNamed:@"navbaractive.png"]];
[[UITabBarItem appearance] setTitleTextAttributes:
[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor colorWithRed:75.0/255.0 green:75.0/255.0 blue:75.0/255.0 alpha:1.0], UITextAttributeTextColor,
[UIColor clearColor], UITextAttributeTextShadowColor,
[NSValue valueWithUIOffset:UIOffsetMake(0, 1)], UITextAttributeTextShadowOffset,
nil] forState:UIControlStateNormal];
[[UITabBarItem appearance] setTitleTextAttributes:
[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor whiteColor], UITextAttributeTextColor,
[UIColor clearColor], UITextAttributeTextShadowColor,
[NSValue valueWithUIOffset:UIOffsetMake(0, 1)], UITextAttributeTextShadowOffset,
nil] forState:UIControlStateSelected];
//nav bar
[[UINavigationBar appearance] setTitleTextAttributes:
[NSDictionary dictionaryWithObjectsAndKeys:
[UIFont fontWithName:@"Rokkitt" size:28.0],
UITextAttributeFont,
nil]];
}
else {
//iOS 4.whatever and below
[self.tabBarController.tabBar insertSubview:imageView atIndex:0];
}
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque animated:NO];
}
你可以使用它只有ios 5和更新 – lesyk 2012-05-04 14:49:03
@lesyk:正確。我鏈接到也說這個文檔,這就是爲什麼我沒有提到它。我不知道如何在iOS之前實現這一點,因爲我沒有看過它;也許你的子類UITabBar,也許你建立自己的。 – Jesper 2012-05-08 07:59:41