iPhone - 即使应用程序仅支持纵向,状态栏也会旋转

发布于 2024-11-17 10:51:28 字数 177 浏览 11 评论 0原文

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

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

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

谢谢!

I am developing an iPhone application that supports only Portrait orientation.
On my device everything works OK, but on my tester's the status bar is autorotating to landscape orientation. The rest of the view remains in Portrait mode.

My tester's device specs are these:
- iPhone 4
- Ver 4.2.8

I couldn't reproduce this error on my device (iPhone 4, 4.3.3).

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

对你而言 2024-11-24 10:51:28

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

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

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

初始界面方向

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

干杯。

Add below function in your all viewController.m files.

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

Add below key in your info.plist file

Initial interface orientation

And set it's value as "Portrait (bottom home button)"

Cheers.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文