How to forcefully make Device in landscape mode
I have and app in that app is running in potr开发者_如何学Pythonait mode and when i go to the next wiew i have to change the device orientation in landscape mode. Is there any way.
Put the below code in your controller class for having different orientation between UIViewControllers,
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
You could also try with below having different orientation between views.
[[UIDevice currentDevice] performSelector:@selector(setOrientation:) withObject:(id)UIInterfaceOrientationLandscapeRight];
No. [UIDevice setOrientation:]
does that, but it's a private API.
精彩评论