这个让我抓狂。我的 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 - 您可以在 Info.plist 中设置方向:
这样你就可以看到所有的键:
关于iphone - UIView 始终以纵向模式加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6933940/