我将我的应用程序目标更改为IOS 13,以检查我的应用程序中弃用的方法,并且我正在收到以下警告:
'UIApplicationDidChangeStatusBarOrientationNotification'被废弃:自iOS 13.0开始首次弃用-请改用viewWillTransitionToSize:withTransitionCoordinator:代替。
这是我在项目中实现的代码。
- (instancetype)init
{
self = [super init];
if (self) {
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(onChangeStatusBarOrientationNotification:)
name:UIApplicationDidChangeStatusBarOrientationNotification
object:nil];
}
return self;
}
请为我提供适用于iOS 12和iOS 13的解决方案。
提前感谢。
viewWillTransitionToSize:withTransitionCoordinator:
并在其中执行你在onChangeStatusBarOrientationNotification:
中所做的操作? - Larme