[英]PushViewController doesn't work - deinit called
從firstController,我嘗試切換viewController:
let player = self.storyboard?.instantiateViewControllerWithIdentifier("WK_player") as? WKViewController
self.navigationController?.pushViewController(player!, animated: true)
但是WKViewController不會出現,而是直接調用他的deinit。
它與
performSegueWithIdentifier("WK_Play", sender: nil)
但是有了這個,當我關閉播放器並保留在內存中時,永遠不會調用dealloc。
dismissViewControllerAnimated(true, completion: nil)
問題是什么 ?
內存泄漏的問題不是performSegueWithIdentifier("WK_Play", sender: nil)
。 問題可能是您在WK_Play VC中某個地方有很強的引用,該引用未被刪除,因此無法釋放VC。
您也可以嘗試使用,但是我敢打賭,內存泄漏仍然存在:
let player = self.storyboard?.instantiateViewControllerWithIdentifier("WK_player") as? WKViewController
self.presentViewController(player, animated: true, completion: nil)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.