在 Xcode 中,我尝试设计一个仅横向的用户界面。
我将 UIViewController 和 UIView 控件都设置为横向模型。但是当我将控件(如按钮、图像)放置在 UIView 上时,当程序运行时,只有放置在左上角区域的控件会响应。看来程序仍在纵向模式下运行。
在项目plist设置中Initial interface orientation
领域在Landscape (left home button)
。还设置Supported interface orientations
field.
并覆盖方法-(BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation) interfaceOrientation
在你的视图控制器中:
- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight));
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)