在我在shouldAutorotate中返回是或否之前,是否有办法验证iOS打算移动到的方向?
从iOS 7开始,您需要使用在我在shouldAutorotate中返回是或否之前,是否有办法验证iOS打算移动到的方向?,ios,objective-c,Ios,Objective C,从iOS 7开始,您需要使用 -(BOOL)shouldAutorotate { return YES; } - (NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskLandscape; } 而不是 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientati
-(BOOL)shouldAutorotate {
return YES;
}
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscape;
}
而不是
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
然而,我的游戏有一些非常混乱的方向设置,我非常喜欢旧方法,因为它允许我做一些棘手的条件,这要归功于参数interface-orientation
。现在我不能。在我在应自动旋转中返回是
或否
之前,是否有办法验证iOS打算移动到的方向?您尝试过吗
UIDeviceOrientation方向=[[UIDevice currentDevice]方向]