- (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];
}
网友评论