我想解僱一個視圖控制器,並在同一時間提出另一個。當Level1Controller()
完成並調用self.dismissViewController()
時,我希望它將我帶到名爲EndScene()
的不同視圖控制器。Swift:dismissViewController和實例化另一個ViewController
這是最接近我的代碼。
self.dismissViewControllerAnimated(true, completion: {() -> Void in
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let nextViewConroller = storyboard.instantiateViewControllerWithIdentifier("endscene")
self.presentViewController(nextViewConroller, animated: false, completion: nil)
})
您遇到@Rogue Studios的實際問題是什麼? –
@RaphaelOliveira它只會啓動我回到根視圖控制器,這是錯誤信息'2015-12-23 17:47:35.333 Spin Game [6466:2789372]警告:嘗試呈現 on 其視圖不在窗口層次結構中!' –
明白了,會寫出答案。 –