Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/36.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
Iphone 在ios 6上仅在一个视图中启用横向定向_Iphone_Ios_Ios5_Ios6 - Fatal编程技术网

Iphone 在ios 6上仅在一个视图中启用横向定向

Iphone 在ios 6上仅在一个视图中启用横向定向,iphone,ios,ios5,ios6,Iphone,Ios,Ios5,Ios6,我只想在我的应用程序的一个视图中启用横向定位。其他视图必须仅支持纵向模式。但对于iOS 6,即使我使用的是iOS 6的最新方法,它也会自动旋转。期待正确的建议。对于仅纵向定位,请尝试以下方法 -(NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskPortrait; } -(BOOL)shouldAutorotate { return NO; } 查看此

我只想在我的应用程序的一个视图中启用横向定位。其他视图必须仅支持纵向模式。但对于iOS 6,即使我使用的是iOS 6的最新方法,它也会自动旋转。期待正确的建议。

对于仅纵向定位,请尝试以下方法

-(NSUInteger)supportedInterfaceOrientations
{           
    return UIInterfaceOrientationMaskPortrait;
}

-(BOOL)shouldAutorotate
{
    return NO;
}

查看此链接,谢谢。。但在链接中使用的方法仍然是支持方向。除了一个支持两个横向和纵向的视图外,我想要纵向。不,它只是不起作用。。我早就试过了。。主要问题在iOS 6中。
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

- (NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskPortrait;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
    return UIInterfaceOrientationPortrait;
}

- (BOOL)shouldAutorotate {
    return FALSE;
}