[英]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.