我将xcode更新为xcode9后得到了一份弃用警告列表,我不知道如何修复它
'interfaceOrientation'已弃用:首先在iOS 8.0中弃用
@org.springframework.transaction.annotation.Transactional(timeout = 123) // 123 sec
答案 0 :(得分:2)
我只是在寻找同样的东西,并在iOS文档中找到了一些东西,并在阅读之后,因为我的用户仍然拥有iOS 8.我保留了旧的两个功能并添加了新的功能。
// old ones
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
[super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
[self handleInterfaceOrientation];
}
-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
[super didRotateFromInterfaceOrientation:fromInterfaceOrientation];
[self handleInterfaceOrientation];
}
// the new method
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
// what ever you want to prepare
} completion:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
[self handleInterfaceOrientation];
}];
}
- (void)handleInterfaceOrientation {
if ([[UIApplication sharedApplication] statusBarOrientation] == UIInterfaceOrientationLandscapeLeft || [[UIApplication sharedApplication] statusBarOrientation] == UIInterfaceOrientationLandscapeRight) {
// Landscape
} else {
// Portrait
}
}