I am building my view hierarchy using code and would like to know whether it is better to create the entire hierarchy in loadView when the request is requested from my controller, and then animate the views on the screen in the viewWillAppear method, or if it is better to keep things simpler, but potentially requires more release and memory allocation by building the entire hierarchy in viewWillAppear.
I understand that the controller calls loadView to create the view for the first time it needs it, and then saves it as long as it can, so you can leave and go back to that controller and animate it in the views, but you don’t need to recreate and attach them through viewWillAppear.
Basically, it seems to me useless to separate the views in the loadView, and then translate (and sometimes update the contents inside) them into viewWillAppear and wonder if the advantages of preserving the views improve simplicity by simply recreating them (and therefore reinitializing them and avoiding them any un reset values).
source
share