简体   繁体   English

iPhone应用程序在横向和纵向模式下都可以正常工作,但在iPad上只能在一种模式下工作?

[英]Iphone app is working fine in both landscape and portrait mode but in ipad it only works in one mode?

I made an ios app which is working fine in the iPhone in both mode either it is landscape or portrait by using the autorotation methods i used the following code 我通过使用自动旋转方法制作了一个可以在iPhone上以横向或纵向两种模式正常工作的ios应用程序,我使用了以下代码

if (toInterfaceOrientation == UIInterfaceOrientationLandscapeRight)
{
    self.view=Landscape;
    self.view.transform=CGAffineTransformMakeRotation(deg2rad* (90));
    self.view.bounds=CGRectMake(0.0,0.0,480.0,320.0);
} else if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft)
{
    self.view=Landscape;
    self.view.transform=CGAffineTransformMakeRotation(deg2rad* (-90));
    self.view.bounds=CGRectMake(0.0,0.0,480.0,320.0);
} else if (toInterfaceOrientation == UIInterfaceOrientationPortrait)
{
    self.view=Portrait;
    self.view.transform=CGAffineTransformMakeRotation(deg2rad* (0));
    self.view.bounds=CGRectMake(0.0,0.0,320.0,480.0);
} else
{
    self.view=Portrait;
    self.view.transform=CGAffineTransformMakeRotation(deg2rad* (180));
    self.view.bounds=CGRectMake(0.0,0.0,320.0,480.0);
}

} }

But for the iPad its work only in one mode either landscape or portrait when i rotate the device it shows the blank white screen but if i don't rotate that it works pretty fine. 但是对于iPad,当我旋转设备时,它只能在横向或纵向两种模式下工作,但显示空白屏幕,但如果我不旋转,则效果很好。 Kindly guide me as i am new to the iOS. 请引导我,因为我是iOS的新手。

One place to check would be on the Application target, general tab, Deployment info section. 需要检查的一个地方是“应用程序”目标的“常规”选项卡上的“部署信息”部分。

Just below the Deployment Target and Devices selectors, you can switch between iPhone and iPad, then enable supported orientations with the checkboxes. 在“部署目标”和“设备”选择器的下方,您可以在iPhone和iPad之间切换,然后通过复选框启用受支持的方向。

If you already have these setup correctly for both iPad and iPhone, then you'll probably want to look at how you've handled the supportedInterfaceOrientations or possibly the preferredInterfaceOrientationForPresentation methods of your UIViewControllers 如果您已经为iPad和iPhone正确设置了这些设置,那么您可能想看看如何处理UIViewControllers的supportedInterfaceOrientationspreferredInterfaceOrientationForPresentation方法

首先看...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM