屏幕旋轉(zhuǎn)前后方向的獲取
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
//屏幕旋轉(zhuǎn)前的方向
UIInterfaceOrientation beforeTransition = [UIApplication sharedApplication].statusBarOrientation;
[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
//屏幕旋轉(zhuǎn)后的方向
UIInterfaceOrientation afterTransition = [UIApplication sharedApplication].statusBarOrientation;
} completion:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
}];
}