zoukankan      html  css  js  c++  java
  • iOS6 与iOS7以及7以上状态栏的颜色设置

    iOS7默认状态栏文字颜色为黑色   


    修改为白色的方法:(chenyong注意 我的Status bar style 使用的仍是默认值Gray style(default))

    1在Info.plist中设置View controller-based status bar appearance 为NO
    2 在需要改变状态栏颜色的ViewController中在ViewDidLoad方法中增加:
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];

    如下:

    - (void)viewDidLoad
    {
        [super viewDidLoad];
        // Do any additional setup after loading the view from its nib.
        [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent];
    }

    如果需要在全部View中都变色,可以写在父类的相关方法中。

    在使用Cordova的时候遇到的状态栏合并问题

    - (void)viewWillAppear:(BOOL)animated
    {
        // View defaults to full size.  If you want to customize the view's size, or its subviews (e.g. webView),
        // you can do so here.
        
        // 导航与状态栏合并的问题
        float currentVersion = [[[UIDevice currentDevice] systemVersion] floatValue];
        
        if (currentVersion >= 7) {
            // bounds 是以自身的左上角为坐标原点
            CGRect viewBounds = [self.webView bounds];
            viewBounds.origin.y = 20;
            viewBounds.size.height = viewBounds.size.height - 20;
            self.webView.frame = viewBounds;
            self.view.backgroundColor = [UIColor blackColor];
        }
    
        [super viewWillAppear:animated];
    }
  • 相关阅读:
    修改oracle的sys、system密码
    错误随手笔记
    JS 全选
    ider向虚拟机上传jar包
    Spring中的八大设计模式
    事务的隔离级别
    hive常用函数全集
    Kafka常用命令
    字符设备驱动框架学习总结
    根文件系统熟悉(一)根文件系统构建过程记录
  • 原文地址:https://www.cnblogs.com/ToFlying/p/4380464.html
Copyright © 2011-2022 走看看