從應用程序委託視圖到視圖控制器的正確方法是什麼?當我收到推送通知時,我正在將用戶轉換爲視圖控制器,但視圖不完整。導航欄看起來不正確。這裏是我的設置:繼續從appdelegate到視圖控制器
tabviewcontroller (storyboard name is 'main')
- nav1controller -> view1controller -? view1detailcontroller (storyboard name is 'view1detail')
- nav2controller -> ...
當推送通知到達時,我想讓用戶訪問veiw1detailcontroller。我想讓用戶回到view1controller。
這是我的代碼:
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let mainViewController = storyboard.instantiateViewControllerWithIdentifier("main") as! UIViewController
let view1detailcontroller = storyboard.instantiateViewControllerWithIdentifier("view1detail") as! view1detailcontroller
let nav = UINavigationController(rootViewController: mainViewController)
nav.pushViewController(view1detailcontroller, animated: true)
self.window!.rootViewController = nav
所以,過渡罰款view1detailcontroller。但是,一旦我回到view1controller,那個屏幕和所有其他屏幕上的導航欄就會顯示「main」,並且所有導航項目也都會丟失。
我在做什麼錯?
這是什麼'nav.pushViewController(view1detailcontroller,animated:true)' –
我需要轉換到view1detailcontroller – Prabhu