Reputation: 21808
My application always launches in landscape mode with the home button on the left side. If the home button on the right side it rotates. How do i make it opposite? I tried setting different values into info.plist file for initial interface orientation
key but it didn't work. I tried switching order of values in this method:
- (NSInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskLandscapeLeft;
}
but it didn't work neither. How do i do that?
Upvotes: 0
Views: 3367
Reputation: 4914
For IOS 5 and 5.1 :
Try to set (BOOL)shouldAutorotateToInterfaceOrientation
in your view controllers, it works for me.
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
return toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || toInterfaceOrientation == UIInterfaceOrientationLandscapeRight;
}
If you are using storyboards you can also set your initial and other viewcontrolers to landscape mode :
For IOS 6:
your (NSInteger)supportedInterfaceOrientations
should be (NSUInteger)
, I am not sure though I never use it.
// Only used by iOS 6 and newer.
- (BOOL)shouldAutorotate
{
//returns true if want to allow orientation change
return TRUE;
}
- (NSUInteger)supportedInterfaceOrientations
{
//decide number of origination to supported by Viewcontroller.
return return UIInterfaceOrientationMaskLandscape;
}
Upvotes: 4