iOS开发 屏幕旋转viewWillTransitionToSi
2022-08-12 本文已影响0人
烟尘_f626
屏幕旋转前后方向的获取
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
//屏幕旋转前的方向
UIInterfaceOrientation beforeTransition = [UIApplication sharedApplication].statusBarOrientation;
[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
//屏幕旋转后的方向
UIInterfaceOrientation afterTransition = [UIApplication sharedApplication].statusBarOrientation;
} completion:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
}];
}