繁体   English   中英

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

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

我通过使用自动旋转方法制作了一个可以在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);
}

}

但是对于iPad,当我旋转设备时,它只能在横向或纵向两种模式下工作,但显示空白屏幕,但如果我不旋转,则效果很好。 请引导我,因为我是iOS的新手。

需要检查的一个地方是“应用程序”目标的“常规”选项卡上的“部署信息”部分。

在“部署目标”和“设备”选择器的下方,您可以在iPhone和iPad之间切换,然后通过复选框启用受支持的方向。

如果您已经为iPad和iPhone正确设置了这些设置,那么您可能想看看如何处理UIViewControllers的supportedInterfaceOrientationspreferredInterfaceOrientationForPresentation方法

首先看...

暂无
暂无

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

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