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

- (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状态栏 检测状态栏是否有热点适配)