ios - UIViewController viewDidLoad vs. viewWillAppear: What is the proper division of labor? -


I have always been a bit unclear on the type of tasks that should be assigned vs. viewDidLoad . View ViewApps : In a UIViewController subclass

For example, I'm doing an app where I have a UIViewController sub-class is killing a server, getting data, feeding it to see And then displays that scene. viewDidLoad versus viewWillAppear ?

See that the load once has to be done whenever the scene is visible Let's see it every time to see it. You should do things you want to do to see only once - like setting up your ULL texts, however, to see the user every time you want to modify a specific part of the scene, eg Whenever you go to the "Play now playing" scene, the iPod app scrolls back to the top.

However, when you are loading things from a server, you will have to think about the delay if you pack all of your network communications in the ViewDidoadload or View option, before the user can view them Will be executed - potentially a small freeze of your app can be the best idea that the user has an unexpected view with some type of activity indicator Ikhaya things. When you are done with your networking, which can take one or two (or may also fail - who knows?), You can populate the view with your data. Good examples on how this can be done. Can be seen in various Twitter clients, for example, when you see the author details page in Twitter extension, the view says only "Loading ..." until the network query is complete.

Hope you got some help,

Leon


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -