Aspects


vs


Home Page
About Us

Viewdidappear

UIViewController instance method that notifies the view controller that its view was added to a view hierarchy.

Viewwillappear

UIViewController instance method that notifies the view controller that its view is about to be added to a view hierarchy.



Others

Example

Use viewdidupdatelayout or viewdidlayoutsubviews if you need to perform layout adjustments in your controller but viewwillappear doesn t work for a weird situation such as a timing issue use viewdidappear is better done in a uiview subclass in my opinion

from question  

Pressing back in navigationcontroller triggered update. But to update ignored tabbar

Edited after some development and many bugs i finished with this elegant solution that i am sure apple would not be happy to approve but i do not know that works from ios 10 to ios 12 when the searchbar is in the tableheaderview the above code can be called in viewwillappear but if it is in the navigationitem on ios 11 and above it should be called in viewdidappear

from question  

Cannot change search bar background color

In this case viewdidappear behaves more like viewwillappear ..

from question  

Why does viewDidAppear in UITabBarController exec before the view appears?

If you put your code in viewwillappear animated this should work;edit as per saphrosit s comment viewdidappear is an even better place to do this

from question  

Send SMS iPhone

You should either use viewdidappear or add a slight delay before displaying the alert controller;viewwillappear is not a good location to present another view controller since the current one being presented is not yet in the window hierarchy and is also in a transition animation

from question  

Creation of UIAlertController on ViewWillAppear gives warning

Back to Home
Data comes from Stack Exchange with CC-BY-SA-4.0