I develop a simple game in iPhone. The whole game is in landscape mode, but the scoreboard page only support portrait mode. I have checked the questions here, I only find turn portrait into landscape mode, but I need the opposite answer. Could anyone help me?
Asked
Active
Viewed 1,558 times
2 Answers
0
I used these two calls in AppDelegate. Getting game center(score board) in landscape only.
// Supported orientations: Landscape. Customize it for your own needs
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_6_0
- (NSUInteger)application:(UIApplication*)application supportedInterfaceOrientationsForWindow:(UIWindow*)window
{
return UIInterfaceOrientationMaskAllButUpsideDown; //Getting error here? then update ur xcode to 4.5+
}
#endif
Xcode settings: Mark landscape.

Guru
- 21,652
- 10
- 63
- 102
-
-
@WolfLink, yes, supportedInterfaceOrientationsForWindow is used for ios6 in my code..its working great:) anyway thanks – Guru Nov 13 '12 at 07:41
0
It's very simple. First, make sure both portrait and landscape orientations are supported in the target summary. Then:
In the landscape ViewControllers, add this:
-(NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskLandscape;
}
And in the portrait ViewController, add this:
-(NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskPortrait;
}

WolfLink
- 3,308
- 2
- 26
- 44