UIStatusBarStyle PreferredStatusBarStyle does not work on iOS 7
Q:
In my iPhone application built with Xcode 5 for iOS 7 I set UIViewControllerBasedStatusBarAppearance=YES in info.plist, and in my ViewController I have this code:
-(UIStatusBarStyle) preferredStatusBarStyle{
returnUIStatusBarStyleLightContent;
}
But the status bar is still black against the black background.
I know its possible to change this app-wide by setting UIViewControllerBasedStatusBarAppearance=NO in info.plist, but I actually need to alter this on a viewController by viewController basis at runtime.
A:
I discovered that if your ViewController is inside a navigationController then the navigationController’s navigationBar.barStyle determines the statusBarStyle.
Setting your navigationBar’s barStyle to UIBarStyleBlackTranslucent will give white status bar text (ie. UIStatusBarStyleLightContent), and UIBarStyleDefault will give black status bar text (ie. UIStatusBarStyleDefault).
Note that this applies even if you totally change the navigationBar’s color via its barTintColor.
http://stackoverflow.com/a/19365160
UIStatusBarStyle PreferredStatusBarStyle does not work on iOS 7的更多相关文章
- 14个技巧助你适配 iOS10
1.Notification(通知) 自从 Notification 被引入之后,苹果就不断的更新优化,但这些更新优化只是小打小闹,直至现在iOS 10开始真正的进行大改重构,这让开发者也体会到 Us ...
- 【转】UINavigationBar 使用总结
原文网址:http://www.jianshu.com/p/f0d3df54baa6 UINavigationBar是我们在开发过程中经常要用到的一个控件,下面我会为大家介绍一些常用的用法. 1. 设 ...
- iOS 修改状态栏preferredStatusBarStyle不执行问题
一.在老版本的iOS中,状态栏永远都是白色风格.而在iOS 7中,我们可以修改每个view controller中状态栏的外观.通过UIStatusBarStyle常量可以指定状态栏的内容是暗色或亮色 ...
- iOS中关于NavigationController中preferredStatusBarStyle一直不执行的问题
重点:真的能改吗?跑起来毛用没有. 1.还要在plist文件里把View controller-based status bar appearance设置成YES. 2.一定要写UINavigatio ...
- iOS 小知识点(持续更新)
1.如何通过代码设置Button title的字体大小 设置Button.titleLabel.font = [UIFont systemFontOfSize:<#(CGFloat)#> ...
- iOS开发 适配iOS10
2016年9月7日,苹果发布iOS 10.2016年9月14日,全新的操作系统iOS 10将正式上线. 作为开发者,如何适配iOS10呢? 1.Notification(通知) 自从Notificat ...
- iOS:小技巧(不断更新)
记录下一些不常用技巧,以防忘记,复制用. 1.获取当前的View在Window的frame: UIWindow * window=[[[UIApplication sharedApplication] ...
- iOS开发 Xcode8中遇到的问题及改动
iOS开发 Xcode8中遇到的问题及改动 新版本发布总会有很多坑,也会有很多改动. 一个一个填吧... 一.遇到的问题 1.权限以及相关设置 iOS10系统下调用系统相册.相机功能,或者苹果健康 ...
- 【转】iOS学习之适配iOS10
适配iOS10 2016年9月7日,苹果发布iOS 10.2016年9月14日,全新的操作系统iOS 10将正式上线. 作为开发者,如何适配iOS10呢? 1.Notification(通知) 自从N ...
随机推荐
- LeetCode: Reverse Integer 解题报告
Reverse Integer Reverse digits of an integer. Example1: x = 123, return 321Example2: x = -123, retur ...
- Python 操作redis 常用方法
Python 操作redis 1.字符串 #!/usr/bin/env python # -*- coding:utf-8 -*- import redis # python 操作str class ...
- 【论文笔记】如何理解深度学习中的End to End
End to end:指的是输入原始数据,输出的是最后结果,应用在特征学习融入算法,无需单独处理. end-to-end(端对端)的方法,一端输入我的原始数据,一端输出我想得到的结果.只关心输入和输出 ...
- ipconfig 命令有什么作用
ipconfig /all:显示本机TCP/IP配置的详细信息:ipconfig /release:DHCP客户端手工释放IP地址:ipconfig /renew:DHCP客户端手工向服务器刷新请求: ...
- kvm libvirt 虚拟机管理
http://www.2cto.com/os/201203/123128.html kvm虚拟机管理一.环境role hostname ip O ...
- Html table 细边框
Html table 细边框 <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "htt ...
- BAT-增加JAVA环境变量(WIN764位)
相关资料:1.http://www.jb51.net/article/52756.htm2.http://blog.csdn.net/fireghost57/article/details/21103 ...
- Maven Tomcat:run 使用tomcat7
<build> <finalName>service</finalName> <resources> <resource> <dire ...
- PHP——安装wampserver丢失MSVCR110.dll
win8系统 64位,在安装wampserver时显示计算机丢失MSVCR110.dll 1.首先是打开浏览器,在浏览器的地址栏里输入 http://www.microsoft.com/zh-CN ...
- SQLServer当数据导入平面文件
SQLServer当数据导入无发正常工作时候,可以尝试BULK命令操作 BULK INSERT [dbo].[test] FROM 'H:\testdb.csv' WITH( FIELDTERMINA ...