• StatusBar


    一、UIViewControllerBasedStatusBarAppearance作用的实际测试

     在作iOS7的适配时,很多文章都会提到UIViewControllerBasedStatusBarAppearance。便一直不是太明白其实际作用。在网上也没有查出明确的说明,苹果的官方文档也是说的不太清楚。在实际测试后发现UIViewControllerBasedStatusBarAppearance的实际作用如下:

            这个属性只影响如何设置status bar上字体的颜色是黑色还是白色,对status bar的背景色无影响。status bar的背景色在iOS7上永远是透明的。

    UIViewControllerBasedStatusBarAppearance = NO时:

    UIApplication 的setStatusBarStyle方法生效:
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];

    viewController的preferredStatusBarStyle方法无效:
    - (UIStatusBarStyle)preferredStatusBarStyle{
        return UIStatusBarStyleLightContent;
    }

    UIViewControllerBasedStatusBarAppearance = YES时:

    UIApplication 的setStatusBarStyle无效。

    viewController的preferredStatusBarStyle方法有效。

    apple官方说明:

    UIViewControllerBasedStatusBarAppearance (Boolean - iOS) specifies whether the status bar appearance is based on the style preferred by the view controller that is currently under the status bar. When this key is not present or its value is set to YES, the view controller determines the status bar style. When the key is set to NO, view controllers (or the app) must each set the status bar style explicitly using the UIApplication object.

    google自动翻译的经果:

    UIViewControllerBasedStatusBarAppearance(布尔 - IOS)指定状态栏的外观是否是基于视图控制器,是目前在状态栏中的首选风格。当这个键不存在,或者它的值设置为YES时,视图控制器决定了状态栏的风格。当按键被设置为NO,视图控制器(或应用程序)都必须显式使用的UIApplication对象中的每个设置状态栏的风格。

    二、

     

  • 相关阅读:
    制作在线简历(一)——Loading与底部菜单
    然而这并没有什么卵用
    移动开发中Fiddler的那些事儿
    多种方法实现Loading(加载)动画效果
    总结)Nginx/LVS/HAProxy负载均衡软件的优缺点详解
    SQLServer和MySQL job和 event定时器的差别
    全局ID的重要性
    Windows操作系统上各种服务使用的端口号, 以及它们使用的协议的列表
    Linux发展历史图
    奇特的Local System权限(转载)
  • 原文地址:https://www.cnblogs.com/yipingios/p/5528644.html
Copyright © 2020-2023  润新知