iphone - Xcode:如何构建仅横向的 iPhone 程序

标签 iphone xcode

在 Xcode 中,我尝试设计一个仅横向的用户界面。

我将 UIViewController 和 UIView 控件都设置为横向模型。但是当我将控件(如按钮、图像)放置在 UIView 上时,当程序运行时,只有放置在左上角区域的控件会响应。看来程序仍在纵向模式下运行。

最佳答案

在项目plist设置中横向(左侧主页按钮)中的初始界面方向字段。还设置支持的界面方向字段。

并在 ViewController 中重写方法 -(BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation) interfaceOrientation:

- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{
    return ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight));
}

关于iphone - Xcode:如何构建仅横向的 iPhone 程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5777313/

相关文章:

iphone - 是否可以在没有Windows或Linux且没有其中一种设备的情况下针对iPhone/iPod Touch进行开发?

Xcode 4 颜色主题在 Xcode 4.4.1 中不起作用

ios - iOS 模拟器可以记住使用 Retina iPhone 和非 Retina iPad 吗?

ios - 无法为版本 14.2 的设备 MacFamily20,1 获取特征集

iphone - Objective-C 无法将 NSInteger 分配给 NSInteger 变量?

ios - 无法使用类型为 'enumerateObjects' 的参数列表调用 '((AnyObject!, NSInteger, UnsafeMutablePointer<ObjCBool>) -> ())'

ios - 使用 gem 安装 cocoapods 时出错

ios - UICollectionViewCell 中的 UICollectionView

ios - iphone 6 和 iphone 6 plus 是否支持为 iphone 4 和 iphone 5 制作的应用程序

iphone - iPhone 支持的视频文件格式