Xcode:如何构建仅支持横屏的iPhone程序

3
在Xcode中,我尝试设计一个仅支持横屏的用户界面。我将UIViewController和UIView控件都设置为横向模式。但是当我在UIView上放置控件(如按钮、图片)时,在程序运行时,只有位于左上角的控件响应。似乎程序仍在以纵向模式运行。

所以你只想要橫向而不是縱向,對吧.. - ajay
打开 info.plist -> supportedinterfaceorientation -> 只添加横向。 - ajay
1
请访问此问题以获取答案:仅限iPhone的横向模式 - Cyprian
1个回答

4
在项目的plist设置中,将“初始界面方向”字段设置为“横向(左侧home按钮)”。还要设置“支持的界面方向”字段。
并在您的ViewController中重写方法-(BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation) interfaceOrientation
- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{
    return ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight));
}

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接