When is viewWillAppear called?

In my opinion, only two instances when viewWillAppear is called are when you initialize your view controller or when you exit the view controller that is on top of it in the navigation stack (i.e., pressing the back button on the view manager in front of it ) Are there other instances when viewWillAppar is called? I do not believe this caused when the application becomes active. Interested to hear some answers to this.

+4
source share
2 answers

The viewwillappear method is called how and when a view controller view is added to the window. (if the view is already in the window and hidden by another view, this method is called when the view opens again). This method is a notification to the view manager that the view should become visible. You can override this method to make any adjustments when presenting a view.

+8
source

It will also be called anytime addSubView is called with your view.

+5
source

Source: https://habr.com/ru/post/1390366/


All Articles