I always thought that viewDidAppear
was called whenever your view appeared on the screen, but I've been told that, for example, when you background an app (by pressing home button) and then bring it back up, viewDidAppear
is not called (going to background "doesn't remove the current view from the view hierarchy"). So, what does it actually mean for a view to "appear"? Also, what does it mean for a view to "load", ie. when does it actually happen (for example, when the app is opened by touching the app icon, etc.)
Is Heirarchy Of this:- Alwys Whenevr Your View Controller Runs It Go Like This
1st ViewDidLoad
2nd ViewAppear
3rd ViewDidAppear
4th ViewWillDisAppear
5th ViewDidDisAppear
Last 6th ViewDidUnload
You Can Understand This by This Simple Life Example :-
Suppose You Are In Cafe And
1st==> You Ordered Coffee Then Service Here Your Call Then They Fill Your Coffee On The Cup (Note Loading Or Filling All Contain Like Coffee on Cup Is Called ViewDidLoad )
2nd==>> And When Service Put Coffee On Your Table (Note Is Called ViewWillAppear Where Your Coffee just Like Your ViewController View )
3rd==>> And When You See Your Coffe (Note Is Called ViewDidAppear Where Your View Can See On Your Screen Just Like When Your See Your Coffee )
4th==>> After That When You Finished Your Macachino Coffee And is Empty (Note is Called ViewWillDisAppear Where Unloading or Proccess Of Empty is Stands For ViewWillDisAppear )
5th & 6th==>> And After That When Service Came And It's Pick Up Your Coffee Cup And Take Back From You When Is Did Disappear From Your Eyes (Note is Called ViewDidDisAppear When View or Your Screen Is Go Blank Just Like Your Cup ) And Finally All Proccesss Done Here....
And If You Again ordered Diff. Coffee Aur Same Coffee That All Step Called Again Same Like That, You Have Multiple ViewController And They Call Again Again A--B--A--B
Thx For Listing This Story Happy Coding
viewDidLoad
is called when all outlets are initialized from a Storyboard.
viewDidAppear
calls when a View Controller is added to another view controller hierarchy. Usually after all animations is finished, but not necessary.
If you implement custom controller which will contain some child view controllers, you will call didMoveToParentViewController
of the child controllers when they are added to the parent. So, whenever you call this method viewDidAppear
of child VC's will be called automatically.
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