Can anyone confirm that [[UIDevice currentDevice] setOrientation:UIDeviceOrientationPortrait];
will get your app rejected by Apple.
Is there a good replacement available?
Can anyone confirm that [[UIDevice currentDevice] setOrientation:UIDeviceOrientationPortrait];
will get your app rejected by Apple.
Is there a good replacement available?
[[UIDevice currentDevice] setOrientation:UIInterfaceOrientation] is a private API, you can find that is signature is only in read-only (see here).
If you want set the device orientation to Portrait or other mode you should override the shouldAutorotateToInterfaceOrientation:
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIDeviceOrientationPortrait);
}
Yes you'll get rejected.
You can change the frame and apply a transformation to the key window, and change the status bar orientation (which is public) to simulate changing the orientation.
You can add UIInterfaceOrientation in your app plist
You can try this code. It works perfectly on my apps
UIApplication* application = [UIApplication sharedApplication];
if (application.statusBarOrientation != UIInterfaceOrientationPortrait)
{
AppDelegate* app = [[UIApplication sharedApplication] delegate];
UIViewController *c = [[UIViewController alloc]init];
[app.viewController presentModalViewController:c animated:NO];
[app.viewController dismissModalViewControllerAnimated:NO];
[c release];
}
where app.viewController is the rootViewController of the app