2012-02-15 37 views

回答

1

您可以在自定義圖層上設置屬性。

或者您可以給自定義圖層引用視圖控制器的屬性,以便當圖層需要知道時,它可以向視圖控制器請求接口方向。

或者您可以讓您的視圖控制器在旋轉時發佈NSNotification,並讓圖層觀察通知。

0
UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation]; 

返回UIInterfaceOrientation,應用程序狀態欄的當前方向。


UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];返回UIDeviceOrientation,設備方向。但請注意,UIDeviceOrientation並不總是UIInterfaceOrientation。例如,當您的設備在普通桌面上時,您可能會收到意外的值。

+0

http://stackoverflow.com/questions/634745/iphone-orientation/3897243#3897243 – beryllium 2012-02-15 09:24:14

相關問題