美文网首页
检测iOS状态栏 检测状态栏是否有热点适配

检测iOS状态栏 检测状态栏是否有热点适配

作者: nihau | 来源:发表于2018-06-01 17:00 被阅读47次
    - (void)viewDidLoad {
        [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(adjustStatusBar) name:UIApplicationDidChangeStatusBarFrameNotification object:nil];
    
    }
    
    
    - (void)adjustStatusBar{
        NSLog(@"33333");
        
        CGRect rectOfStatusbar = [[UIApplication sharedApplication] statusBarFrame];
        NSLog(@"statusbar height: %f", rectOfStatusbar.size.height);   // 高度
        self.myWebView.frame =CGRectMake(0, 20, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height-rectOfStatusbar.size.height);
        
    }
    
    
    

    记住 在dealloc记住移除

    - (void)dealloc{
        [[NSNotificationCenter defaultCenter] removeObserver:self];
        
    }
    
    

    相关文章

      网友评论

          本文标题:检测iOS状态栏 检测状态栏是否有热点适配

          本文链接:https://www.haomeiwen.com/subject/rneksftx.html