I have the following items in my app nib:
In my AppDelegate applicationDidFinishLaunching, I do this:
Question/problem: when I do all of the above, viewDidAppear: is not firing for "d". (but viewDidLoad IS firing.) How do I find out why it is not firing, and fix it so that it would fire?
(Why I want to use viewDidAppear: the above involves some chained animations and viewDidAppear looks like a good place for a view controller to know when its view has been loaded and animated, so it can trigger subsequent animations.)
The difference between viewDidAppear and viewDidLoad is that viewDidAppear is called every time you land on the screen while viewDidLoad is only called once which is when the app loads.
viewDidAppear is called once you see the loaded view on screen. It is called after view appeared. ViewDidAppear is called everytime when you see the view after it is loaded.
viewwillappear method is called as and when the view controller's view is added to the window. ( if the view is already in the window and is hidden by another view, this method is called when the view is once again revealed). The method is a notification to the view controller that the view is about to become visible.
Notifies the view controller that its view is about to be added to a view hierarchy.
Usually when you're manually screwing with the view hierarchy you won't get -viewWillAppear:
, -viewDidAppear
, etc.; they're called by various SDK methods, like -pushViewController:animated:
, -presentModalViewController:animated:
, and by UITabBarController
when a tab gets selected.
When you add a view to the hierarchy yourself, it may or may not be onscreen or going-to-be-onscreen; the -addSubview:
method doesn't make any assumptions about your intentions. Just call 'em yourself as you add the 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