iphone项目中的ipad旋转

问题描述:

我创建了一个专门针对iPhone的项目(现在),我选择了支持的方向仅肖像。在iPhone上它很棒,但是当我在iPad上启动我的项目时,我的应用程序正在旋转!其实我试图使它成为一个通用的应用程序,并且在iPad部署信息中我只选择了支持的方向肖像,我的应用程序仍在iPad上旋转。我该如何解决这个问题?iphone项目中的ipad旋转

要在您的视图仅支持人像模式,实现您的每一个意见如下:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{ 
    return (interfaceOrientation == UIInterfaceOrientationPortrait); 
} 

此外,还需要确保已经设置了支持的设备取向为每个设备以及:

enter image description here

enter image description here

+0

但是,当我设置在项目部署信息支持的方向,不应该够了吗? – Alexander

+0

应该是。也许你已经设置了'shouldAutorotateToInterfaceOrientation:',只要确保你有这个方法与我的匹配。 – WrightsCS

+0

是的,它的工作,非常感谢,@ rooster117感谢您的回答 – Alexander

您可以手动实现此功能设置视图控制器的旋转值:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 
    return (interfaceOrientation == UIInterfaceOrientationPortrait; 
}