ios 7 statusbar跟随navigationbar的颜色而改变


在此输入图片描述

首先,我们要搞清楚info.plist中 View 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:

1
[[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];

转子oschina
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值