2010-06-04 61 views
1

我正在使用UINavigationController來推送和彈出視圖。導航欄是隱藏的。UINavigation Controller和Autorotation

我有RootViewController,它被設置爲自動旋轉。當它可見時它工作得很好。 我也有GalleryViewController。它僅通過返回no來禁用自動旋轉。


我的問題是,當GalleryViewController是導航堆棧上,RootViewController的停止響應它的自動旋轉事件。


如果我在肖像,我旋轉設備(同時觀看GalleryViewController),然後點擊返回按鈕,它會彈出的GalleryViewController出棧,並揭示了RootViewController的,但RootViewController的沒有改變的旋轉,因爲它應該有。

我卡在方法-viewWillAppear中,並檢查UIDevice方向的狀態。它給了我設備的正確方向。

順便說一句,我也嘗試啓用GalleryViewController中的自動旋轉。然後它正確地旋轉視圖,但仍然不旋轉RootViewController。


看來,當使用導航控制器,只有堆棧的頂部得到旋轉。


問題:由於設備知道它在當-viewWillAppear被稱爲正確的旋轉,我可以強制它以某種方式更新?

-mark

回答

0

,而不是在RootViewController的只是返回YES,收益率(interfaceOrientaion == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationLandscapeLeft ||等等...)。

在GalleryViewController中只返回一個方向,這在我們看來是默認方向。

當這樣做 - 一切都應該像你想要的那樣工作。