Unified Contacts

16 November, 2013

[Question] UIScrollView doesn't work in Storyboard

I cannot make UIScrollView work when I add some components into it using Storyboard with auto layout turned on. So, I now add all components by code.

Does anyone know how to fix it? Thanks~

12 September, 2013

Common Mistake: initWithCoder VS viewDidLoad

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.