Xcode:如何构建一个只有iphone程序的风景

时间:2011-04-25 10:08:02

标签: iphone xcode

在Xcode中,我试图设计一个仅景观用户界面。

我都将UIViewController和UIView控件设置为横向模型。但当我放置控件,如按钮,UIView上的图像,当程序运行时,只有位于左上角区域的控件响应。似乎程序仍然以纵向模式运行。

1 个答案:

答案 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));
}