How can I compare viewDidLoad
and viewDidAppear:
Asked
Active
Viewed 1,382 times
-5

nevan king
- 112,709
- 45
- 203
- 241

Lazy_Clutch
- 130
- 3
- 14
-
5what you want to compare? viewDidLoad runs one time when view is loaded and viewDidAppear runs everytime when view is appearing on the screen – nsgulliver Mar 06 '13 at 12:21
-
1put NSLog on both functions to understand which is called when.. – P.J Mar 06 '13 at 12:23
-
Refer more on this :- http://stackoverflow.com/questions/11254697/difference-between-viewdidload-and-viewdidappear – P.J Mar 06 '13 at 12:23
1 Answers
7
The best thing to do is to implement both methods in a view controller that loads a view with subviews (easiest is from a NIB) and put a breakpoint into each method. When the app stops on each breakpoint, look at the Variables view in the debugger and see what objects have been instantiated.
To eliminate confusion about the UIViewController
lifecycle, here's a diagram taken from Big Nerd Ranch iOS Programming:

nevan king
- 112,709
- 45
- 203
- 241
-
-
-
-
You should put more description, elaborate like put NSLog, debugging is dam difficult.. Also, you can put code when is viewDidLoad and viewDidAppear Called.. – P.J Mar 06 '13 at 12:37
-