I have a game in SpriteKit in landscape. It runs fine on any iPhone, but when I run the app on an iPad, it is always in portrait. How do I fix this?
1. First of all select the orientation in the general part of your App:
2. A very common error is to not check the info.plist. There you can set the supported orientations for each iPhone and iPad. (Make sure to delete both iPad Portrait options)
Related
I need to create portrait only orientation for iPhone and landscape only for iPad. What is smartest way to archive it?
In xcode tab "General"->Deploy Info->Device Orientation, check the right option.
I have an universal project, and want to keep landscape from very beginning of star-up for iPhone and portrait for Pad. How can I do it?
That's not possible. iPhone apps always have to start in Portrait orientation. Any game you see that has landscape-only display is still starting showing a portrait default image and the root view controller then can be landscape-only.
On iPad you can restrict the app orientation to Landscape and also have it start in Landscape.
The iPhone restriction is enforced by Apple and they won't approve an iPhone app that restricts itself to Landscape start.
If the device is already in landscape position it will start as landscape, but if you want your program to work always in landscape position and never flip to portrait, you have to set the orientation to landscape in each class you create:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationLandscape || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown);
}
If my iPhone App (not universal) starts in landscape mode on my iPad (3rd gen) it does not respond to any touch until I either press the 1x/2x Button or change the orientation. After that it works as normal.
If I start it on my iPhone 5 in landscape mode, it works like a charm.
shouldAutorotateToInterfaceOrientation gives a YES in every View, so I think that's not the problem here.
The first View is a tabbar-view.
I have the same problem too on my iPad mini with iOS6.0.1.
What I do to solve the problem is to set the Supported interface orientations to all off in the info.plist.
Next, add the Supported interface orientations (iPad) in info.plist and only add the Potrait (bottom home button) in it.
It should make no difference to the apps orientation provided that you set it properly in the view controller.
Also, make sure you set a correct initial interface orientation.
It then solves my problem.
The above answers are a bit difficult, especially when using Xamarin. This answer does work:
from another question:
iphone app doesn't respond after starting in landscape orientation on iPad
The comment of Daniel Sandland did solve it for me:
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];
in didFinishLaunchingWithOptions,
(the C# variant for Xamarin)
I think this can be the problem of positioning of UI controls present on your screen.
The controls might be having auto positioning parameters (in XIB) may have been set in such way that the controls goes out of screen.
Try to correct resizing parameters in XIB.
I wonder why, if a Single View app is created brand new for iPad, and clicking on the Project, I chose in "Support Device Orientation" to be Landscape Left, and in ViewController's shouldAutorotateToInterfaceOrientation, I return YES only when it is UIInterfaceOrientationLandscapeRight, then the app can actually start up as Portrait mode?
I more expected the app to start up as Landscape Left and be able to rotate to Landscape Right and then won't be able to rotate to any other orientation. I wonder what caused the above behavior?
I'm trying to set a Landscape splash for my iPad app but it's not working.
I currently have a Default-Landscape.png and a Default-Portrait.png.
I added the four orientation in my plist file and still nothing.
It works if I launch in portrait, but if I launch in Landscape the screen stay black until my app start.
Is there anything else to do to get it working?
If you've made sure that Default-Landscape.png is actually in your application's bundle (try to readd it), made sure there was no Default.png, and added all 4 orientations in "supported interface orientations" in the plist and saved it; it should work as expected.