swift3,xcode8 IOSswift3學嘗試提出〜誰的觀點是不是在窗口層次
我創建調用上的小工具按鈕的應用程序來顯示特定頁面App
例如,一個應用程序由viewA和viewB組成,第一個視圖是viewA 我試圖在按下按鈕中的按鈕時顯示viewB。
來源
let mainStoryboard: UIStoryboard = UIStoryboard (name: "Main", bundle: nil)
let DetailView: Detail_Update_View = mainStoryboard.instantiateViewController(withIdentifier: "Detail_Update_View") as! Detail_Update_View
let nav2 = UINavigationController.init (rootViewController: DetailView)
self.window?.rootViewController? .present (nav2, animated: true, completion: nil)
這是從AppDelegate中的FUNC open url
調用。
當您單擊小部件中的按鈕時,最初會調用viewB。 再次打開窗口小部件並按下按鈕 的頁面被稱爲但是信息不會改變,以下錯誤將顯示
的errorMessage
Warning: Attempt to present <UINavigationController: 0x101a1b600> on <SWRevealViewController: 0x101820c00> whose view is not the window hierarchy!
如果你犯了一個首先調用小部件,關閉viewB屏幕(轉到viewA),然後單擊小部件中的按鈕以使其工作。
請幫助我..
那麼你就需要設置初始視圖 - 控制在故事板。 – KKRocks
試試這個:http://stackoverflow.com/a/40304837/3901620 – KKRocks
@KKRocks謝謝你的回覆。這看起來像工作!但是..如果我嘗試3次,我必須按回退按鈕3次才能返回到每個頁面。有沒有辦法一次去viewA? –