简体   繁体   English

iOs7标签栏更改

[英]iOs7 tab bar changes

At ios 6.1 and previous I have like this: 在ios 6.1和之前我喜欢这个:

iOS6的

I need to add support to iOS 7 ( and keep 5.1, 6.0, 6.1) but at iOS 7 it look like this: 我需要添加对iOS 7的支持(并保留5.1,6.0,6.1),但在iOS 7中它看起来像这样:

IOS 7

At xib file my settings at tab bar: 在xib文件中我在标签栏中的设置:

标签栏

At tab controller: 在选项卡控制器:

标签控制器

What to change, where to have a similar look as previous versions? 要改变什么,哪里有与以前版本类似的外观?

You can change the color of the highlighted icons by setting the tintColor of the tabBar . 您可以通过设置tabBartintColor来更改突出显示的图标的颜色。 Like so: 像这样:

// Example UITabBarController
UITabBarController *tabVC = [UITabBarController alloc] init];

tabVC.tabBar.tintColor = [UIColor yellowColor];

Based on Eric answer I have solved the problem like this: 根据Eric的回答,我已经解决了这样的问题:

在此输入图像描述

Observe: the Translucient is unchecked! 观察:Translucient未经检查!

And looks like this: 看起来像这样:

在此输入图像描述

Observe: The text color is yellow instead of white. 观察:文本颜色为黄色而不是白色。

Try This its Working.... 试试这个工作....

in Didfinishlaunching 在Didfinishlaunching

 UITabBarController *tabBarController = (UITabBarController *)self.window.rootViewController;

    UITabBar *tabBar = tabBarController.tabBar;
    UITabBarItem *tabBarItem1 = [tabBar.items objectAtIndex:0];
    UITabBarItem *tabBarItem2 = [tabBar.items objectAtIndex:1];
    UITabBarItem *tabBarItem3 = [tabBar.items objectAtIndex:2];
    UITabBarItem *tabBarItem4 = [tabBar.items objectAtIndex:3];
   UITabBarItem *tabBarItem5 = [tabBar.items objectAtIndex:4];

Set your Selected and Unselected TabImage Here.. . 在此设置您选择和未选择的TabImage ..

     [tabBarItem1 setFinishedSelectedImage:[UIImage imageNamed:@"Tab_icon-selected-_Home-ipad.png"] withFinishedUnselectedImage:
     [UIImage imageNamed:@"Tab_icon_Home-ipad.png"]];

    [tabBarItem2 setFinishedSelectedImage:[UIImage imageNamed:@"Tab_icon-selected-_Products-ipad.png"] withFinishedUnselectedImage:
     [UIImage imageNamed:@"Tab_icon_Products-ipad.png"]];

    [tabBarItem3 setFinishedSelectedImage:[UIImage imageNamed:@"Tab_icon-selected-_Manuf.-Facili-ipad.png"] withFinishedUnselectedImage:
     [UIImage imageNamed:@"Tab_icon_Manuf.-Facili-ipad.png"]];

    [tabBarItem4 setFinishedSelectedImage:[UIImage imageNamed:@"Tab_icon-selected-_R-n-D-ipad.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"Tab_icon_R-n-D-ipad.png"]];

    [tabBarItem5 setFinishedSelectedImage:[UIImage imageNamed:@"Tab_icon-selected-_contact-Us-ipad.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"Tab_icon_contact-Us-ipad.png"]];

Note:- Set all Tabs Selected image Dynamically in Tabbaritem in Property Window 注意: -在属性窗口的Tabbaritem中动态设置所有选项卡选定图像

您可以将标签栏设置为旧样式,如下所示:

self.tabBar.barStyle = UIBarStyleBlack;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM