我想這取決於用戶在哪裏我的應用程序支持的方向來定義,我有一個非常困難的時期這樣做。shouldAutorotate不會被調用
到目前爲止,我已經發現我應該使用iOS6中現在支持的supportedInterfaceOrientationsForWindow:和shouldAutorotate方法,但是無論哪種方法在我的UIViewController中定義它們時都不會調用。
這是我的代碼是什麼樣子
- (BOOL)shouldAutorotate {
return YES;
}
- (NSUInteger)supportedInterfaceOrientationsForWindow {
return UIInterfaceOrientationMaskPortrait;
}
在我的目標概要支持Orientatoin我已經取消選擇所有選項..想,我只想在每個m ViewControllers的定義支持的方向...我會想知道這是否是正確的事情?
現在我已經讀什麼,我試圖做的是依賴於我的應用程序的藥結構,所以在這裏,我將概述我的應用程序。
- 主要的UIViewController(3個按鈕帶你到(3個不同的navigationControllerViews)錯了!只有一個navigationController ......對不起它以來我看着這個代碼很長一段時間。)
- 次要的UIViewController(持有導航控制器)
- 其他UIViewControllers(出現在secondarys NavigationController)
我想每一個的ViewController起來,直到最後一個在NavigationController堆出現在portrate。 NavigationController中的最後一個視圖是一個特殊的視圖,需要時可以將其方向旋轉到左側或右側。
我想知道這是可能的,如果是這樣,爲什麼心不是我有上面的工作代碼/被調用。
任何幫助將不勝感激。
//更新質疑回覆:
RootView負載與(三個按鈕,這裏是當選擇一個按鈕,被稱爲加載包含導航控制器視圖的方法)
- (IBAction)buttonClick: (UIButton *) sender
{
//..
// v ----->
if ([sender isEqual:vUIButton]) {
VSearchViewController *vSearchViewController = [[VSearchViewController alloc] initWithNibName:@"VSearchViewController" bundle:nil];
[self.navigationController pushViewController:vehicalSearchViewController animated:YES];
}
//..
}
然後裏面VSearchViewController我加載到UINavigation堆棧這樣
//..
FModelsViewController *fModelsViewController = [[FModelsViewController alloc] initWithNibName:@"FModelsViewController" bundle:nil];
// Sets the back button for the new view that loads (this overrides the usual parentview name with "Back")
self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Back" style: UIBarButtonItemStyleBordered target:nil action:nil];
[self.navigationController pushViewController:fModelsViewController animated:YES];
//..
所以在檢討,我已經設置了導航控制器的新觀點在的appDelegate和我的應用程序的所有意見都在navigationStack ......我錯在說有3個NavigationControllers ..只有一個,每個視圖添加到堆棧..我們對此深感抱歉..它已經有一年因爲我看着這個代碼半..
沒關係,我會後的過渡代碼..我的應用程序正在變成升技獸的不少意見,由於我想代表數據的複雜性。我會在幾分鐘內更新我的問題..我會盡我所能提供您需要的信息。 (是,我正在部署到iOS6,它在「目標」>「iosApplication目標」>「部署目標」中正確定義?)。 – HurkNburkS 2013-03-13 21:40:57
你需要確保你在ios6模擬器上運行它。僅僅因爲你的部署目標是6並不意味着你在6上運行它。 – 2013-03-13 21:44:24
是我在我的ios6設備上運行。另外我已經更新了一些代碼。 – HurkNburkS 2013-03-13 22:03:02