I'm making an application which will be landscape only. Therefore, my root UIViewController is set to be landscape (开发者_Go百科all xib files I have are landscape orientation).
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
When I try to touch a button in one of the subviews, it does not receive a touch. If I remove the override shown above, the buttons get the touches, but the subview is shown in portrait orientation.
How should I work around this problem?
Thanks & Best Regards,
David
Aside from that, you have to set the supported orientations in your info.plist file.
Its under "Supported interface orientations", with key "UISupportedInterfaceOrientations". Remove the portrait orientations in the list.
精彩评论