我有另一個方向問題。但是這個非常棘手。 我的RootViewController是一個正常的NavigationController。方向風景 - >人像不工作
self.window.rootViewController = _naviController;
裏面有另一個ViewController,我們稱之爲VC1。 VC1有一些按鈕和標籤。它就像文件夾的概述。
如果我按下一個按鈕,我來與3視圖控制器(頁)下一個視圖控制器和按鈕的另一一束(如文件夾內看圖片/內縮略圖):
Archiv *archiv = [[Archiv alloc] init];
[self.navigationController pushViewController:archiv animated:YES];
[archiv release];
中的loadView
:
firstPage = [[Page alloc] initViewWithFrame:CGRectMake(0, 0, 768, 960)];
[firstPage setRootViewController:self];
secondPage = [[Page alloc] initViewWithFrame:CGRectMake(0, -960, 768, 960)];
[secondPage setRootViewController:self];
thirdPage = [[Page alloc] initViewWithFrame:CGRectMake(0, 960, 768, 960)];
[thirdPage setRootViewController:self];
如果我現在上的按鈕再次點擊活動頁面推我的第三個視圖控制器(帶圖像縮放,拖動......):
Picture *pic = [[Picture alloc] initWithPicURLString:urlString];
[rootViewController.navigationController pushViewController:pic animated:YES];
[pic release];
使用NavigationController的BackButton,我總是可以回到以前的視圖。
一些更多的信息:
- 每個視圖控制器支持所有方向
- 每個視圖控制器實現
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
與return YES;
- 每ViewControler調用它們的init-梅索德
- 我已經讀過Apple's Q&A: Why won't my UIViewController rotate with the device 的
[super init]
現在棘手的問題:
如果我從第2個VC切換到第3 VC,還有來自縱向更改方向爲橫向,按後退按鈕一切工作(shouldAutorotateToInterfaceOrientation
呼籲,幀大小和起源改變...)。 但,如果我周圍做它的其他方式,我在風景模式,從第2個VC切換到第3 VC,旋轉爲縱向,回來第2個VC與後退按鈕的狀態 - 和controllerBar是在頂部但是shouldAutorotateToInterfaceOrientation
未被稱爲。
請幫幫我。 $ h @ rky
是的,這項工作也是,但這不能回答問題爲什麼當我回到縱向方向時視圖沒有調用。無論如何,如果nodoby告訴我爲什麼這會在下週發生,我會接受答案。 – Sharky
就像我承諾的接受和upvote,因爲決議比我的方式xD更聰明。 $ H @ RKY – Sharky