标签云

微信群

扫码加入我们

WeChat QR Code

I created two view controllers likeNavigation controller -> View Controller -> Details View Controller1 23The (2) View Controller has a button in it which when clicked will shows (3) Details View Controller. I have created a segue from button to (3) VC.I have added deinit blocks in those two classes.deinit {print("vc deinit")}However, this does not get logged. When will a view controller get deallocated?Sample code


Related (Duplicate?): stackoverflow.com/questions/26971415/deinit-never-called

2019年04月25日37分16秒

None of the provided solutions answer this question.

2019年04月25日37分16秒

Is there any special code that might leads to a retain cycle in the view controllers?

2019年04月25日37分16秒

jsloop: Your first sketch shows the reason: The navigation controller holds a reference to the first VC.

2019年04月25日37分16秒

AhmadF: The root view controller is the navigation controller in this case. But yes, this was just a comment, not intended to cover all possible situations.

2019年04月25日37分16秒