Launch iPhone App on iPad with landscape mode

In the project summary, “Supported interface orientations” is selected, since my application has a photo gallery view that can be rotated using the device. Other views are just a portrait. The target devices are the iPhone, and everything works well on the iPhone. But when it works in my iPad with landscape mode, the splash and rootView look like this:

Splash landscape: enter image description here

rootview landscape: enter image description here

What I expected should look the same as the iPad with portrait mode:

Splash portrait: enter image description here

rootview portrait: enter image description here

The root element MyNavigationController, some related code is as follows:

MyNavigationController.m

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

- (NSUInteger)supportedInterfaceOrientations {
  return UIInterfaceOrientationMaskPortrait;
}

- (BOOL)shouldAutorotate {
  return NO;
}
+5
source share
3 answers

, :

- (BOOL)shouldAutorotate {
   return YES;
}

- (NSUInteger)supportedInterfaceOrientations {
   return UIInterfaceOrientationMaskPortrait;
}

YES shouldAutorotate. , NO, supportedInterfaceOrientations , . shouldAutorotate, .

Reference:

, , . , . , Autorotate YES.

+9

, , ?

, iPhone , , iPhone- .

" ".

+2

I assume that you want the status bar to be portrayed. Unfortunately, there is no easy way to do this - you can only set the device / interface orientation to protrait, but this applies to the entire application. And you will need to handle the orientation of all the views yourself. So, I suggest you follow the Hide status bar when starting the image , hide the status bar and use the same image in both orientations. This will make the screen saver look better.

+2
source

All Articles