使用wkWebView播放网页上的视频,播放完成后,退出视频返回到网页发现app的状态整个被隐藏了,解决方法,监听状态栏隐藏通知,在适当的时候让状态栏显示出来
[[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];
}
}
}