UIScreen applicationFrame在横向应用程序启动时返回不正确的矩形(iPhone / iPad) [英] UIScreen applicationFrame returning incorrect rectangle on landscape application launch (iPhone/iPad)

查看:162
本文介绍了UIScreen applicationFrame在横向应用程序启动时返回不正确的矩形(iPhone / iPad)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在以横向模式启动iPad应用程式时,无法取得正确的边界。我在Info.plist文件中设置了正确的键,并且我的视图控制器在横向(和纵向,插入)中正常启动。

Having trouble getting the correct bounds for my iPad application when launching it in landscape mode. I have the proper keys set in my Info.plist file, and my view controllers launch properly in landscape (and portrait, natch).

在我的 applicationDidFinishLaunching:方法我在调用选择器3秒钟后,该方法调用 [[UIScreen mainScreen] applicationFrame] ,但它返回一个人像框架(即高度>宽度)。

In my applicationDidFinishLaunching: method I'm calling a selector after a 3 second delay, and that method makes a call to [[UIScreen mainScreen] applicationFrame], but it's returning me a portrait frame (ie height > width).

有人知道如何解决这个问题吗?

Does anyone know how to fix this? It smells like a bug to me (if so I'll file a radar), but if it's intended behaviour, where is it documented?

推荐答案

当您以横向方式握持iPad并启动应用程序时,视图控制器最初会看到纵向视图的边界(即使方向报告横向)。然后,视图控制器将在显示之前获取旋转到横向的消息。

When you are holding the iPad in landscape orientation and launch an app, the view controller initially sees bounds for a portrait view (even though orientation reports landscape). The view controller will then get a message to rotate to landscape orientation before it appears.

这篇关于UIScreen applicationFrame在横向应用程序启动时返回不正确的矩形(iPhone / iPad)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆