views:

10

answers:

1

Hi, I'm struggling to understand the correct model.

I have a uitableview full of rows of data. The data is the result of a REST call, which depends on the result of a previous REST call.

So in my appDelegate didFinishLaunchingWithOptions: method I'm making an NSURLConnection for the first REST call and then getting the results back in didReceiveData: delegate method. When that's finished, I need to make a second rest call - so I'm doing that in the connectionDidFinishLoading: method of the first REST call; which in itself feels wrong - but i don't know how else to only do it when the first REST call has finished (without multi-threading and synchronizing which seems overkill given how powerful this stuff is).

So then i get the xml back from the second REST call and build up my data objects ready for the UITableView:cellAtIndexPath: delegate method.

But - the UI is already drawn before the data objects are populated - so i can't figure out where to put in a spinner, and how to synchronise on the connectionDidFinishLaunching: message of the second REST call . does that makes sense? IT's really a pattern question, more than a code question - but i can't find a good example.

regards, Richard

A: 

Ah. So it's [self reloadData].

I was thinking it was going to work like Adobe Flex; where the table is bound to the dataSource - and a change in the dataSource changes what the table shows.

but no - I just need to tell the UITableView to reload its data once i've populated the array/data.

So I'll answer myself.

richard