Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/35.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
Objective c 无法将iPhone旋转到正确的方向_Objective C_Iphone_Ios7_Rotation_Xcode5 - Fatal编程技术网

Objective c 无法将iPhone旋转到正确的方向

Objective c 无法将iPhone旋转到正确的方向,objective-c,iphone,ios7,rotation,xcode5,Objective C,Iphone,Ios7,Rotation,Xcode5,我的iPhone设备有这种奇怪的行为。 Hi构建了一个视图控制器,可以在横向模式下从左向右旋转。在模拟器中一切都很顺利,但当我在iPhone上构建项目时,它总是向左旋转 这里有两种处理方向的方法 - (BOOL)shouldAutorotate { return NO; } - (NSUInteger)supportedInterfaceOrientations { return UIDeviceOrientationLandscapeRight | UIInterfaceOr

我的iPhone设备有这种奇怪的行为。 Hi构建了一个视图控制器,可以在横向模式下从左向右旋转。在模拟器中一切都很顺利,但当我在iPhone上构建项目时,它总是向左旋转

这里有两种处理方向的方法

- (BOOL)shouldAutorotate {
    return NO;
}

- (NSUInteger)supportedInterfaceOrientations {
    return UIDeviceOrientationLandscapeRight | UIInterfaceOrientationMaskLandscapeLeft;
}
这是某种加速度计问题吗

谢谢

而不是

- (NSUInteger)supportedInterfaceOrientations {
    return UIDeviceOrientationLandscapeRight | UIInterfaceOrientationMaskLandscapeLeft;
}
用这个

- (NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskLandscapeLeft;
}

也许你已经锁定了iPhone上的旋转?将你的
UIDeviceOrientation和scapeRight
替换为
UIInterfaceOrientationMask和scapeRight
谢谢@spassas!下次我会把我写的读得更好。