Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在我在shouldAutorotate中返回是或否之前,是否有办法验证iOS打算移动到的方向?_Ios_Objective C - Fatal编程技术网

在我在shouldAutorotate中返回是或否之前,是否有办法验证iOS打算移动到的方向?

在我在shouldAutorotate中返回是或否之前,是否有办法验证iOS打算移动到的方向?,ios,objective-c,Ios,Objective C,从iOS 7开始,您需要使用 -(BOOL)shouldAutorotate { return YES; } - (NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskLandscape; } 而不是 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientati

从iOS 7开始,您需要使用

-(BOOL)shouldAutorotate {
    return YES;
}
- (NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskLandscape;
}
而不是

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
然而,我的游戏有一些非常混乱的方向设置,我非常喜欢旧方法,因为它允许我做一些棘手的条件,这要归功于参数
interface-orientation
。现在我不能。在我在
应自动旋转
中返回
之前,是否有办法验证iOS打算移动到的方向?

您尝试过吗

UIDeviceOrientation方向=[[UIDevice currentDevice]方向]