问题
How can I start my app in landscape mode, and keep the screen rotation that way?
回答1:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
回答2:
Implement the view controller's shouldAutorotateToInterfaceOrientation: method and return UIInterfaceOrientationIsLandscape(orientation);
Also set the Info.plist keys UIInterfaceOrientation and UISupportedInterfaceOrientations to UIInterfaceOrientationLandscapeLeft and UIInterfaceOrientationLandscapeRight. UIInterfaceOrientation will take a single value so assign one of them and assign both of them to UISupportedInterfaceOrientations.
来源:https://stackoverflow.com/questions/6353076/make-app-start-and-remain-in-landscape-mode