-5

How can I compare viewDidLoad and viewDidAppear:

nevan king
  • 112,709
  • 45
  • 203
  • 241
Lazy_Clutch
  • 130
  • 3
  • 14
  • 5
    what 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
  • 1
    put 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 Answers1

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:

enter image description here

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