What I want is Portrait orientation for iPhone and Landscape orientation for iPad app.
My app is targeted for > ios5
I searched on web about this but got different answers but not the exact one.
Asked
Active
Viewed 383 times
0

Inder Kumar Rathore
- 39,458
- 17
- 135
- 184
2 Answers
0
So here is what I did
For iPhone
and for iPad
And for iPad controllers I added below code, this is not necessary for ios6 applications
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight ||
interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}

Inder Kumar Rathore
- 39,458
- 17
- 135
- 184
0
You should be able to do this by simply adding this code to your app delegate.
Swift code:
func application(application: UIApplication, supportedInterfaceOrientationsForWindow window: UIWindow?) -> Int {
if UIDevice.currentDevice().userInterfaceIdiom == .Phone {
return Int(UIInterfaceOrientationMask.Portrait.rawValue)
} else {
return Int(UIInterfaceOrientationMask.LandscapeLeft.rawValue | UIInterfaceOrientationMask.LandscapeRight.rawValue)
}
}

Travis M.
- 10,930
- 1
- 56
- 72