iphone - 如何在 iPhone 应用程序上仅支持纵向模式

标签 iphone objective-c xcode autorotate device-orientation

我在开发的 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/

相关文章:

iphone - 为什么我的代码中不需要保留但它有效

iphone - 将 Json 加载到 uitableview 中

iphone - 以编程方式将委托(delegate)实例化到组件

iphone - 不完整的实现 xcode buttons to disable buttons

iphone - 为什么 NSUserDefaults 无法保存 NSMutableDictionary?

iphone - iOS 上的无摩擦请求 - 如何实现?

iphone - 拖动 UIButton 或 UIImage 而无需子类化

ios - Objective-C Self 和 Synthesize 关键字

ios - UITabBarController setSelectedIndex 性能低下

xcode - 尝试运行作为构建步骤的Shell脚本时,Xcode4出现Shell脚本调用错误