I have a
User class and want to display many users’ thumbnails w/ their name overlayed & a green dot overlayed if they’re online, etc. in a grid-like tableView (like Grindr, similar to iPhone’s Camera Roll).
First, I fetch a JSON array of user data for the nearest (geographically) 20 users from the server. Then, I parse the JSON and insert them in the managedObjectContext.
How do I display these users in a UITableView? I was thinking of using an NSFetchedResultsController, but I’ve never seen an example with NSURLConnection. Here’s something I found, but I don’t really get it cause it’s not very thorough:
Still, I think I’m gonna see if I can do something like that unless you give me a better idea.
Once I have the user data, I’ll have a thumbView (subview) for each user’s thumbnail and do something like this: http://www.markj.net/iphone-asynchronous-table-image/ to load the user thumbnail for each thumbView.
How would you go about doing this? Should I even use Core Data? Should I just use an
NSArray? I figured using Core Data could make for a better UX and reduce server bandwidth.
The project is called acani on github.
Usually, with Core Data you would create two context, one for the UI and one for the URL connection. The URL connection runs on a background thread. It downloads the data, creates the managed objects and then saves. The you merge changes with the UI context and the fetched results controller should automatically detect the data changes and update the table.