我在开发的 iPhone 应用程序中遇到了一个奇怪的问题。我希望我的应用程序仅 支持纵向模式,但出于某种原因我不能这样做(设备和模拟器)。
为了只支持纵向模式,我做了如下操作:
- 在 Xcode 的目标摘要部分,我只选择了纵向。
- 我所有的 ViewControllers 实现
shouldAutorotateToInterfaceOrientation
但正如我所说,它不起作用,奇怪的结果是该应用程序支持所有方向(纵向、倒置、左侧横向、右侧横向)。
有任何想法吗?
这就是我如何实现 shouldAutorotateToInterfaceOrientation
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
NSLog(@"Checking orientation %d", interfaceOrientation);
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
我刚刚注意到,当我旋转手机时,我收到这条消息:
"Two-stage rotation animation is deprecated. This application should use the smoother single-stage animation."
这是什么意思?
最佳答案
在 Target Summary 上选择 portrait only。
关于iphone - 如何在 iPhone 应用程序上仅支持纵向模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10032490/