iphone - UIView 始终以纵向模式加载

标签 iphone ios ipad

这个让我抓狂。我的 iPad 应用程序设置如下:

在我的应用程序委托(delegate)中,我有这个:

[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];

在我的 info.plist 中我有:

Initial Interface Orientation = UIInterfaceOrientationLandscapeLeft

在我的第一个从应用程序委托(delegate)加载的 View Controller 中,我有:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{
    // Return YES for supported orientations.
    return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}

在我的第二个 View Controller 中,我有:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{
    // Return YES for supported orientations.
    return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}

最后,两个 Nib 中的 View 都在 Interface Builder 中设置为横向。应用程序以横向模式启动,并且有一个按钮,按下该按钮会将第二个 View 分配给第一个 View :

self.view = secondView.view;

问题是,即使所有内容都是横向的,新 View 总是以纵向模式加载?请对此提供任何帮助,我们将非常感激!

最佳答案

这是您想要更改的部分。这就是设置允许的初始方向的原因。更改它以满足您的需要。

它位于目标设置的摘要选项卡中。

Xcode 4

或者。如果您还没有使用 Xcode 4 - 您可以在 Info.plist 中设置方向:

Xcode 3

这样你就可以看到所有的键:

Xcode 3 All keys

关于iphone - UIView 始终以纵向模式加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6933940/

相关文章:

ios - 如何更改 iOS 7 中未选中的选项卡栏项目的颜色?

ios - 错误编译 alamofire - : -Xlinker 中的未知选项字符 `X'

用于世界地图 UI 的 iOS 库,如 Ocarina 或 UNIQLO Wake Up

iphone - 如何将 UIView 渲染到 CGContext

iphone - MKMapView RegionDidChangeAnimated 并不总是被调用!

ios - 为什么按下 UISearchbar 上的取消按钮时会出现 UIKeyboard?

ios - spritekit,纹理图像有时加载有时不加载

iphone - flowcover View 替代方案(使用 uiwebview 而不是 uiimage)

ios - 批准应用并准备出售后,无法通过应用购买iOS设备

ios - 你如何为 3D 触摸查看 Controller 制作 "title bar"