1
我有一個標籤欄應用程序,顯示幾個選項卡。我通知的情況下,我希望用戶被引導到一個視圖控制器與能力推「後退」。 當我的應用程序只是導航控制器的應用程序,我用這個代碼在我的AppDelegate:從TabBar應用程序的AppDelegate Push ViewController應用程序
UIStoryboard *mainStoryboard = self.window.rootViewController.storyboard;
DetailViewController *detailViewController = (DetailViewController*)[mainStoryboard instantiateViewControllerWithIdentifier: @"detailViewController"];
[(UINavigationController*)self.window.rootViewController pushViewController:detailViewController animated:NO];
該代碼使用,直到我將我的應用程序是標籤欄,做工精細。看起來像「self.window.rootViewController」不再是「UINavigationController」類型,因此調用「pushViewController」會生成一個異常,表示方法不存在。 任何方式使這項工作在選項卡欄應用程序?
感謝
你想讓這個新的viewcontroller覆蓋標籤欄嗎?你想要後退按鈕做什麼? – Joel 2013-02-08 23:46:25
是的。這是一個新聞應用程序。如果用戶滑動通知,我想打開一個視圖控制器直接顯示新聞項目。然後按回我希望他回到常規選項卡視圖。 – bashan 2013-02-09 14:53:41