//添加监听
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(setNeedsStatusBarAppearanceUpdate) name:UIWindowDidBecomeHiddenNotification object:nil];
重写状态栏隐藏方法
- (BOOL)prefersStatusBarHidden {
return UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation);
}
本文介绍了如何在iOS应用中通过监听窗口隐藏通知来更新状态栏显示状态,并提供了一个偏好设置状态栏隐藏的方法实现,该方法会根据设备的屏幕方向自动判断是否隐藏状态栏。
1213

被折叠的 条评论
为什么被折叠?



