0

I'm using the RestKit library to load json from my REST services, and then mapping the data to an object.

If I apply that retrieved object as the datasource, the tableview datasource methods run before the json is downloaded, which leaves [list count] at 0.

Now, how do I prevent the table from loading or refresh the table when the json is retrieved?

Adam
  • 8,849
  • 16
  • 67
  • 131

1 Answers1

0

1.) Read your JSON into an array and use that as the data source for your table 2.) If your JSON updates, have some function

-(void)tableDataDidUpdate

that takes in your JSON, throws out the old table data array and replaces it with a new array.

3.) Make sure to call "reloadData"

    [self.tableView reloadData];
Delete
  • 922
  • 8
  • 12
  • yep, I placed [self.tableView reloadData]; in the RestKit delegate for when the data is fully retrieved. However, it's not very attractive when you see the default empty cells suddenly change into large cells with content. I may need to look into a loading screen function! – Adam Aug 31 '11 at 18:17