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];
    }
  • 相关阅读:
    yum install nginx
    逻辑分区增加空间 vm中
    pbspro build rpm and installation
    centos 6 and 7 to modify hostname
    activeMQ
    cgo在mac上编译
    redis学习
    Spring Boot 2+gRPC 学习系列1:搭建Spring Boot 2+gRPC本地项目
    KumuluzEE
    前端实现“查看更多”效果
  • 原文地址:https://www.cnblogs.com/ToFlying/p/4380464.html
Copyright © 2011-2022 走看看