I'm not good in communicating between controllers, so i need to setup and check a lot from NSUserDefaults, may it cause any problems?
-
Running a long process in viewDidLoad will make the app unresponsive for a period of time. If this happens between table views, your app will stall with the table cell highlighted, causing a lot of frustration for your users. – Matisse VerDuyn Mar 27 '12 at 17:49
2 Answers
It depends on what you intend to do after the form start-to-finish of loading the view.
You don't want to do too much in viewWillAppear
(Called when the view is ready to be shown) as it could impact performance; typically you want to do things like refresh a table, or update the text on a label etc. The viewDidLoad
method is called once the view is loaded and it is common to add things like buttons, labels etc, anything that you want to appear on the view. If you have anything tasks that may take long to execute, it is better to do them in the viewDidAppear
as the view has already been loaded; it is good practice to perform these methods on a separate thread, or at least provide the user with some sort of activity indicator until the work is done.

- 5,991
- 6
- 40
- 65
-
This helped me to solve the viewDidLayoutSubviews infinite loop bug. Thanks. I just put my minimal setup code in viewWillAppear. – paulmrest Mar 24 '15 at 08:24