Answer the question
In order to leave comments, you need to log in
How to call dealloc in one controller?
The essence of the task:
there is a ViewController
It has a property view2 = UIView ()
in the viewDidLoad () method, I programmatically create dimensions for it and add it to the main view.
Question: how can the viewWillDisappear() and viewDidDisappear() methods be called in the same controller?
They after all come before and after removal.
Thank you
Answer the question
In order to leave comments, you need to log in
If I understood you correctly, then you need to close the UIViewController from within?
If so, you can try the method
func dismiss(animated flag: Bool,
completion: (() -> Void)? = nil)
viewWillDisappear()
and viewDidDisappear()
these are the view controller life cycle methods, these methods are called by the UIKit framework itself, manually, usually they are not called. They are called by the framework when the view of the controller is about to disappear and when it has disappeared, respectively, only after that the controller will be removed from memory.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question