简体   繁体   中英

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

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. Kindly guide me as i am new to the 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.

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

首先看...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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