在Xcode中,我试图设计一个仅景观用户界面。
我都将UIViewController和UIView控件设置为横向模型。但当我放置控件,如按钮,UIView上的图像,当程序运行时,只有位于左上角区域的控件响应。似乎程序仍然以纵向模式运行。
答案 0 :(得分:4)
Initial interface orientation
中的项目plist设置Landscape (left home button)
字段。同时设置Supported interface orientations
字段。
并在ViewController中覆盖方法-(BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation) interfaceOrientation
:
- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight));
}