9

I've started learning IOS, I'm wondering does the viewdidload: method get called before the view appears on screen? The apple developer guide says this method gets called after the view is loaded into memory but I don't understand What "loaded into memory" means, does it mean the view doesn't appear on screen?

modusCell
  • 13,151
  • 9
  • 53
  • 80
hello_java
  • 101
  • 1
  • 1
  • 3
  • possible duplicate of [iPhone: What gets called after viewDidLoad before viewWillAppear?](http://stackoverflow.com/questions/6821067/iphone-what-gets-called-after-viewdidload-before-viewwillappear) – memmons Aug 12 '14 at 18:21
  • yes, please refer view controller life cycle https://stackoverflow.com/questions/5562938/looking-to-understand-the-ios-uiviewcontroller-lifecycle – pransi_k Jul 31 '17 at 12:12

4 Answers4

18

Does the viewdidload method get called before the view appears?

Yes.

Borrowed from this answer, view controller delegate method order is:

- (void)loadView;
- (void)viewDidLoad;
- (void)viewWillAppear;
- (void)viewDidAppear;

What "loaded into memory" means?

It means when the object (view) is created. It is possible to create and show a view virtually at the same time. However, technically viewDidLoad will be called first.

Community
  • 1
  • 1
Jason McCreary
  • 71,546
  • 23
  • 135
  • 174
0

Yes, viewDidLoad method is called before viewDidAppear:.

viewDidLoad and viewDidLoad: mean actually different things. You specify : if it has an argument, but viewDidLoad does not, just as a convention.

Loaded in memory means ready to use/display.

ppalancica
  • 4,236
  • 4
  • 27
  • 42
0

Yes, it is called before. ViewDidAppear - it is called when the view is visible to the user, here is the place to start an animation or something like that.

More information about the view controller lifecycle: https://stackoverflow.com/a/5570363/3482000

Community
  • 1
  • 1
Sandro Machado
  • 9,921
  • 4
  • 36
  • 57
0

Yes viewdidload: is called before viewWillAppear:. and The apple developer guide says this method gets called after the view is loaded into memory means, The viewController in storyboard/XIB is loading into device memory. Other way we can say the user interface which i design into XIB or storyboard is loding into memory...

BHASKAR
  • 1,201
  • 1
  • 9
  • 20