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];
    }
  • 相关阅读:
    android事件拦截处理机制详解
    序列化
    事件系统的一般性
    Android应用启动、退出分析
    Android Activity.startActivity流程简介
    ActivityThread
    Android Activity学习笔记——Activity的启动和创建
    attachBaseContext
    新认识的类
    深入理解Intent和IntentFiler(一)
  • 原文地址:https://www.cnblogs.com/ToFlying/p/4380464.html
Copyright © 2011-2022 走看看