Iphone ios6中的选项卡栏背景色未更改
我在一个项目中工作,我需要在这个项目中实现选项卡栏控制器。我的选项卡栏背景颜色为黑色,为此我使用了以下代码: >Iphone ios6中的选项卡栏背景色未更改,iphone,objective-c,ios6,uitabbarcontroller,Iphone,Objective C,Ios6,Uitabbarcontroller,我在一个项目中工作,我需要在这个项目中实现选项卡栏控制器。我的选项卡栏背景颜色为黑色,为此我使用了以下代码: > 这在ios7中运行良好,但在ios6中没有反映这一行。关于ios6中的tab-bar属性,我还需要实现什么或遗漏什么?任何帮助都将不胜感激。他们在iOS 7中对颜色做了很多改变。阅读苹果公司的人机界面指南: 代码如下: //check if this is not iOS 7 if (floor(NSFoundationVersionNumber) <= NSFoundatio
这在ios7中运行良好,但在ios6中没有反映这一行。关于ios6中的tab-bar属性,我还需要实现什么或遗漏什么?任何帮助都将不胜感激。他们在iOS 7中对颜色做了很多改变。阅读苹果公司的人机界面指南: 代码如下:
//check if this is not iOS 7
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {
//your code above except last line
//Tint is background in iOS 6 but text color in iOS 7
self.tabBarController.tabBar.tintColor = [UIColor blackColor];
}else{
//your code above
}
//检查这是否不是iOS 7
if(楼层(NSFoundationVersionNumber)
tabBarItem1.title=@"Home";
tabBarItem2.title=@"Connect";
tabBarItem3.title=@"About";
tabBarItem4.title=@"Settings";
[[UITabBarItem appearance] setTitleTextAttributes:
[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor colorWithRed:139.0/255.0 green:189.0/255.0 blue:208.0 alpha:255.0], UITextAttributeTextColor,
[UIFont fontWithName:@"Arial" size:0.0], UITextAttributeFont,
nil] forState:UIControlStateNormal];
[[UITabBarItem appearance] setTitleTextAttributes:
[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor whiteColor], UITextAttributeTextColor,
[UIFont fontWithName:@"Arial" size:0.0], UITextAttributeFont,
nil] forState:UIControlStateSelected];
[tabBarItem1 setFinishedSelectedImage:[self imageWithImage:[UIImage imageNamed:@"home_icon_selected.png"] scaledToSize:CGSizeMake(24, 18)] withFinishedUnselectedImage:[self imageWithImage:[UIImage imageNamed:@"home_icon.png"] scaledToSize:CGSizeMake(24, 18)]];
[tabBarItem2 setFinishedSelectedImage:[self imageWithImage:[UIImage imageNamed:@"connect_icon_selected.png"] scaledToSize:CGSizeMake(24, 18)] withFinishedUnselectedImage:[self imageWithImage:[UIImage imageNamed:@"connect_icon.png"] scaledToSize:CGSizeMake(24, 18)]];
[tabBarItem3 setFinishedSelectedImage:[self imageWithImage:[UIImage imageNamed:@"about_icon_selected.png"] scaledToSize:CGSizeMake(24, 18)] withFinishedUnselectedImage:[self imageWithImage:[UIImage imageNamed:@"about_icon.png"] scaledToSize:CGSizeMake(24, 18)]];
[tabBarItem4 setFinishedSelectedImage:[self imageWithImage:[UIImage imageNamed:@"settings_icon_selected.png"] scaledToSize:CGSizeMake(24, 18)] withFinishedUnselectedImage:[self imageWithImage:[UIImage imageNamed:@"settings_icon.png"] scaledToSize:CGSizeMake(24, 18)]];
self.tabBarController.tabBar.tintColor = [UIColor whiteColor];
//check if this is not iOS 7
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {
//your code above except last line
//Tint is background in iOS 6 but text color in iOS 7
self.tabBarController.tabBar.tintColor = [UIColor blackColor];
}else{
//your code above
}