I don't understand when I should implement something in viewDidUnload
versus viewDidDisappear
. What's the difference between the two?
For instance, I'd like to send an NSNotification
when the view controller is removed from the view hierarchy. Between these two methods, does it matter where I post that notification from?
https://developer.apple.com/documentation/uikit/uiviewcontroller
This is with reference to apple's documentation:-
viewDidUnload:-
When a low-memory condition occurs and the current view controller’s views are not needed, the system may opt to remove those views from memory. This method is called after the view controller’s view has been released and is your chance to perform any final cleanup. If your view controller stores separate references to the view or its subviews, you should use this method to release those references. You can also use this method to remove references to any objects that you created to support the view but that are no longer needed now that the view is gone.
viewDidDisappear:-
Notifies the view controller that its view was removed from a view hierarchy that is everytime view dissapears or move to other view.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With