Reputation: 801
We developed an app in Portrait mode, without acelerometer support.
We need, for usability, to turn 180º de app, so we need the app on Upside Down mode. We check in xib properties, if we found something magical to achive that...no way
any, clue? any help?
thanks in adavance
Upvotes: 0
Views: 3378
Reputation: 939
As stated by Steven Kramer, define this in your view controller :
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
if (toInterfaceOrientation == UIInterfaceOrientationPortrait)
return YES to allow it or NO to forbid it
if (toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown)
return YES to allow it or NO to forbid it
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft)
return YES to allow it or NO to forbid it
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeRight)
return YES to allow it or NO to forbid it
return NO; // Unknown value
}
If you only want to accept landscape mode for example, use
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
return UIInterfaceOrientationIsLandscape(toInterfaceOrientation);
}
For portrait only, use return UIInterfaceOrientationIsPortrait(toInterfaceOrientation);
Upvotes: 5
Reputation: 8513
Your view controller needs to override -[UIViewController (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation]
and return YES for upside down portrait orientation.
Can't be done in IB.
Upvotes: 2