44 IOS7状态栏【statusbar】与导航栏【navigationbar】同步颜色 - 雪炭网

IOS7状态栏【statusbar】与导航栏【navigationbar】同步颜色2015-04-13 11:20:44

( 1人已投票,[高质量] )
分享:
31.3K

在此输入图片描述

首先,我们要搞清楚info.plist中 controller-based status bar appearance这个属性
View controller-based status bar appearance =NO
这个设置为:View Controller 不对status Bar 显示进行操作

然后在viewcontroller里面修改navigationbar的颜色
[[UINavigationBar appearance] setBarTintColor:[UIColor colorWithRed:65/255.0 green:159/255.0 blue:252/255.0 alpha:0.5]];

官方给出的意思
To customize the appearance of all instances of a class, send the relevant appearance modification messages to the appearance proxy for the class.(自定义的一个类的所有实例的外观,发送相关信息到外观的外观的代理类)For example, to modify the bar tint color for all UINavigationBar instances:

[[UINavigationBar appearance] setBarTintColor:myColor];

这样就可以了

这里还可以特定容器类的选项:
下面见官方定义:
To customize the appearances for instances of a class contained within an instance of a container class:

[[UINavigationBar appearanceWhenContainedIn:[UISplitViewController class], nil] setBarTintColor:myColor];
[[UINavigationBar appearanceWhenContainedIn:[UITabBarController class], [UISplitViewController class], nil] setBarTintColor:myTabbedNavBarColor];




相关推荐:




头像

snowcoal
  • IOS7
  • 状态栏
  • 颜色

本文标签:

IOS7状态栏颜色

收藏到我的私密空间

标题:IOS7状态栏【statusbar】与导航栏【navigationbar】同步颜色

作者:柳岸花明

你暂未登录,请登录后才可收藏至您的私密空间 确认取消
雪炭网

键盘操作 更便捷 -雪炭网雪中送炭-乐趣无限

如果本站的内容有幸帮助到了您,建议您了解一下当页的广告内容哦,我们的进步离不开您的支持,Thank you~