One of the common mistake is that initializing objects/variables in viewDidLoad method. However, the best place to initialize objects/variables in ViewController is initWithCoder. When creating new files of UIViewController, they do not contain this method, therefore type this method manually in .h and .m file.
Difference:
initWithCoder is called when using Storyboard which initialize ViewController object. Usually used to initialize objects/variables.
viewDidLoad is called when it is loaded into memory and it only happens once. Usually used to instantiate objects/variables.
12 September, 2013
09 September, 2012
Let's get started
I have planned to write some apps for smartphone for a long time. I have so many ideas in my mind, and I think it's the time to start. I would like to record my learning journey and share to everyone.
Subscribe to:
Posts (Atom)