2010-07-29 13 views
0

每當我的應用程序旋轉,只有viewController我已經添加他的視圖作爲子窗口的主窗口獲取他的interfaceOrientation屬性更新,其餘的仍然不知道設備已被旋轉的事實。只有直接的MainWindow視圖的子視圖才能獲取由iOS設置的方向?

是否有責任通知其他對象的變化,如果是這樣,那麼做一個好的方法是什麼?

我查看了我的children-viewcontrollers的設置interfaceOrientation,但這是隻讀的。

由於提前,

回答

0

我發現打電話

willRotateToInterfaceOrientation 

和/或

didRotateFromInterfaceOrientation 
你會在視圖控制器的

,以示對我的工作。在我的情況下,我使用的是導航控制器,因此很容易跟蹤接下來向用戶顯示的內容。以下是我的項目中的一些代碼。

- (void)navigationController:(UINavigationController *)navigationController 
     didShowViewController:(UIViewController *)viewController 
     animated:(BOOL)animated { 
    [viewController willRotateToInterfaceOrientation: 
     [self interfaceOrientation] duration:0];  
} 
+0

我做了同樣的事!工作得很好,也許這是最好的方法。當然最合乎邏輯的一個。 :) – Nick 2010-08-10 09:05:34

相關問題