我需要從ViewController獲取設備方向。 我不能立足於:如何通過UIView參考獲取設備方向?
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
,因爲它(當裝置規定在桌子上例如)有時會返回取向是未知的。
我只需要知道什麼方向是我目前的UIView顯示(它是風景左側還是右側風景)。我不需要在改變方向時更新這個值,我只是想知道它,當我要求時。只是一些參考view.orientation;)。有什麼能幫助我嗎?我讀過UIView文檔,發現了一些對UIWindow的引用,但沒有任何東西可以幫助我。
這正是我所喜歡的爲...而努力。現在我可以獲取UIKit組件的方向並使用它。非常感謝! – thelion 2012-04-27 07:10:07