问题描述:
使用web播放视频后 状态栏丢失 或者 使用web播放视频后页面上移 20
解决办法:
#pragma mark --通知
-(void)addObserverNotification{
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(windowDidBecomeHidden:) name:UIWindowDidBecomeHiddenNotification object:nil];
}
-(void)windowDidBecomeHidden:(NSNotification *)noti{
UIWindow * win = (UIWindow *)noti.object;
if(win){
UIViewController *rootVC = win.rootViewController;
NSArray<__kindof UIViewController *> *vcs = rootVC.childViewControllers;
if([vcs.firstObject isKindOfClass:NSClassFromString(@"AVPlayerViewController")]){
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];
}
}
}