zoukankan      html  css  js  c++  java
  • 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对象中的每个设置状态栏的风格。

    二、

     

  • 相关阅读:
    JavaScript_01简介,基本语法,运算符
    JAVA_内部类
    JAVA_接口_默认方法&静态方法
    软件工程_01面向对象分析
    mybatis_16逆向工程
    mybatis_15整合ehcache
    mybatis_14二级缓存
    mybatis_13一级缓存
    mybatis_12延时加载_懒加载
    JWT如何在Spring Cloud微服务系统中在服务相互调时传递
  • 原文地址:https://www.cnblogs.com/yipingios/p/5528644.html
Copyright © 2011-2022 走看看