I want to rotate my app upside down portrait using the following code in the ViewController:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{ //return NO;
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationMaskPortraitUpsideDown);
}
- (UIInterfaceOrientationMask) supportedInterfaceOrientations
{
return [super supportedInterfaceOrientations] | UIInterfaceOrientationMaskPortraitUpsideDown | UIInterfaceOrientationMaskPortrait;
}
In the AppDelegate:
- (UIInterfaceOrientationMask) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
return UIInterfaceOrientationMaskPortraitUpsideDown | UIInterfaceOrientationMaskPortrait;
}
When the user presses a button
NSNumber * value = [NSNumber numberWithInt:UIInterfaceOrientationPortraitUpsideDown];
[[UIDevice currentDevice] setValue:value forKey:@"orientation"];
The app does somehow not rotate and I have no idea why. Somebody can give a hint? Thank you I added the orientations in the info.plist and set the checkboxes in the general settings in deployment info section.