簡體   English   中英

為什么在旋轉5,6中不應該調用AutorotateToInterfaceOrientation?

[英]Why is shouldAutorotateToInterfaceOrientation not called in rotation 5,6?

一切都很好,方法“ shouldAutorotateToInterfaceOrientation”被調用為標准方向,例如縱向,縱向向下,橫向向右和橫向向左。 但是,我注意到,當iphone面朝下或面朝上躺在桌子上時,並沒有調用它。 在我的代碼中[UIDevice currentDevice] .orientation為此返回一些值,如5和6,但是,正如我所說的,對於這些方向沒有調用旋轉事件方法。 我想念什么嗎?

為什么會這樣? 如果用戶將設備平放在桌子上,界面方向應如何反應? 設備無法分辨哪個方向是“正確的”方向。

設備方向≠接口方向

interfaceOrientation旋轉后,應用程序用戶界面的方向。 可能的值在UIInterfaceOrientation中進行了描述。

typedef enum {
   UIInterfaceOrientationPortrait           = UIDeviceOrientationPortrait,
   UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown,
   UIInterfaceOrientationLandscapeLeft      = UIDeviceOrientationLandscapeRight,
   UIInterfaceOrientationLandscapeRight     = UIDeviceOrientationLandscapeLeft
} UIInterfaceOrientation;

如您所見,方向是界面方向,而不是設備方向。

您可能需要看一下: 閱讀加速度計

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM