I want to know the key difference between awakeFromNib() and viewDidLoad() to get more clarity on how it works . Please can anybody explain?
-
possible duplicate of [Which should I use, -awakeFromNib or -viewDidLoad?](http://stackoverflow.com/questions/377202/which-should-i-use-awakefromnib-or-viewdidload) – vard Aug 13 '15 at 15:59
-
possible duplicate of [Explain awakeFromNib, initwithFrame usage](http://stackoverflow.com/questions/8451900/explain-awakefromnib-initwithframe-usage) – mattt Aug 13 '15 at 15:59
1 Answers
From Apple documentation:
awakeFromNib
:
The nib-loading infrastructure sends an awakeFromNib message to each object recreated from a nib archive, but only after all the objects in the archive have been loaded and initialized. When an object receives an awakeFromNib message, it is guaranteed to have all its outlet and action connections already established.
See: Nib Files in Resource Programming Guide
viewDidLoad
:
This method is called after the view controller has loaded its view hierarchy into memory. This method is called regardless of whether the view hierarchy was loaded from a nib file or created programmatically in the loadView method. You usually override this method to perform additional initialization on views that were loaded from nib files.

- 111,848
- 21
- 189
- 228
-
9
-
2
-
2So for this question (http://stackoverflow.com/questions/36673624/manipulate-ib-outlets-in-awakefromnib-for-uicollectionviewcell-even-if-not-using), would awakeFromNib be the right place to manipulate IB outlets? Basically, the question asks where do you initialize outlets for a UICollectionViewCell if *not* using a custom XIB? – Crashalot Apr 17 '16 at 07:57