iOS设置状态栏样式可以使用两种方式.

方式一:

直接在需要改变默认状态栏样式的控制器中实现一个方法(其他任何事情都不用做):

// 返回状态栏的样式
- (UIStatusBarStyle)preferredStatusBarStyle{
return UIStatusBarStyleLightContent;
}
// 控制状态栏的现实与隐藏
- (BOOL)prefersStatusBarHidden{
return YES;
}

当当前控制器消失的时候, 状态栏样式还原默认样式. 而且使用了这种方式之后, 使用

[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;

设置状态栏将不起作用.

方式二:

在info.plist文件中添加一个属性: 选中表空白地方, 右键选中Add Row, 然后在列表中选择View controller-based status bar appearance, 并设置为No(不支持在文件中设置状态栏样式), 然后在AppDelegate中写上

[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;

就可以设置全局状态栏了. 其他的界面如果想要改变样式的话,直接用

[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;

即可.

iOS设置状态栏样式的更多相关文章

  1. 配置Info.plist (设置状态栏样式、自定义定位时系统弹出的提示语、配置3DTouch应用快捷菜单)

    一.概述 iOS中很多功能需要配置Info.plist才能实现,如设置后台运行.支持打开的文件类型.自定义访问隐私内容时弹出的提示等.了解Info.plist中各字段及其含义,可以访问苹果开发网站相关 ...

  2. iOS 设置字体样式

    1.iOS设置字体样式   label.font = [UIFont fontWithName:@"Arial-BoldItalicMT" size:24];   字体名如下: F ...

  3. iOS 设置状态栏的背景颜色

    设置状态栏的背景颜色 - (void)setStatusBarBackgroundColor:(UIColor *)color { UIView *statusBar = [[[UIApplicati ...

  4. iOS开发 设置状态栏样式

    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault animated:NO];

  5. iOS设置状态栏的字体颜色

    设置statusBar的[前景色部分] 1.plist设置statusBar 在plist里增加一行 UIStatusBarStyle(或者是“Status bar style”也可以),这里可以设置 ...

  6. IOS改变状态栏样式

    1.状态栏高亮颜色 在info.plist中添加 View controller-based status bar appearance 设置为 "NO"在AppDelegate. ...

  7. 设置状态栏样式Demo

    达到的效果: 色有黑色变为了白色 //设置状态条的样式 - (UIStatusBarStyle)preferredStatusBarStyle { returnUIStatusBarStyleLigh ...

  8. ios 设置状态栏文本颜色为白色

    1,在.plist文件中添加一个键值对:设置View controller-based status bar appearance的值为NO 2,在方法中 - (BOOL)application:(U ...

  9. iOS 设置状态栏的颜色

    1.在plist文件中设置如下属性: 2.在delegate中设置 [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarSt ...

随机推荐

  1. Ubuntu命令模式基础

    Ubuntu是一个自由.开源.基于Debian的Linux发行版.在ubuntu的基础上,又衍生其它各具特色的Linux发行版.首先是一个操作系统,操作系统用于管理电脑硬件.要发挥出电脑的作用,还得依 ...

  2. 探索Windows命令行系列(3):命令行脚本基础

    1.实用功能 1.1.为脚本添加注释 1.2.控制命令的回显 1.3.使用数学表达式 1.4.向脚本传递参数 2.使用变量 2.1.变量的命名及定义 2.2.调用变量 2.3.变量的作用域 3.结构语 ...

  3. Flash TextField selectable bug block TextEvent.Link solution

    There is an old version Felx SDK bug(in my case it's Flex SDK v3.3.0.4852) that when TextField.selec ...

  4. JAVA数字求和

    设计思想:把子符串转换成数字,通过Integer.parseInt(),然后通过循环求和. 流程图:

  5. linux 升级yum对应的python

    这里记录一下linux 系统升级python对yum带来影响的解决办法 很多人在使用linux系统执行python任务的时候需要升级linux系统自带的python到高级版本.具体如何升级python ...

  6. 【LeetCode】258. Add Digits

    题目: Given a non-negative integer num, repeatedly add all its digits until the result has only one di ...

  7. 1.Google Chrome浏览器 控制台全解析

    Google Chrome浏览器 控制台全解析 在Google Chrome浏览器出来之前,我一直使用FireFox,因为FireFox的插件非常丰富,更因为FireFox有强大的Firebug,对于 ...

  8. Python爬虫学习之爬美女图片

    最近看机器学习挺火的,然后,想要借助业余时间,来学习Python,希望能为来年找一份比较好的工作. 首先,学习得要有动力,动力,从哪里来呢?肯定是从日常需求之中来.我学Python看网上介绍.能通过P ...

  9. phpstorm,webstorm取消自动保存并标识修改的文件为星星标记

    a.取消自动保存是去掉一下两个勾选. b.标记星星要勾选下面的选项.

  10. Hibernate错误:Exception in thread "main" org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update

    报错:Exception in thread "main" org.hibernate.exception.SQLGrammarException: Could not execu ...