【问题标题】:iPhone - Status bar rotate even if the app supports only Portrait orientationiPhone - 即使应用程序仅支持纵向方向,状态栏也会旋转
【发布时间】:2011-09-23 08:30:31
【问题描述】:

我正在开发一个只支持纵向的 iPhone 应用程序。 在我的设备上一切正常,但在我的测试仪上,状态栏会自动旋转到横向。视图的其余部分保持纵向模式。

我的测试人员的设备规格如下: - iPhone 4 - 版本 4.2.8

我无法在我的设备(iPhone 4、4.3.3)上重现此错误。

谢谢!

【问题讨论】:

  • 你配置好plist文件了吗?即在支持的方向键下仅添加了 2 个方向支持?你重写了 -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation 吗?
  • @Jennis 我没有改变任何东西。 -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterface‌​方向默认设置为Partrait模式,我在Info.plist中有所有必需的条目

标签: iphone orientation statusbar landscape-portrait


【解决方案1】:

在所有 viewController.m 文件中添加以下函数。

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations.
    return (interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown); // support only portrait
}

在 info.plist 文件中添加以下键

初始界面方向

并将其值设置为“人像(底部主页按钮)”

干杯。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-02-18
    • 1970-01-01
    • 1970-01-01
    • 2015-06-14
    • 2014-11-28
    • 1970-01-01
    • 2023-04-01
    • 2015-02-25
    相关资源
    最近更新 更多