Question

(First question related to iPhone development, so apologies for sounding off-track.)

I'm creating a view that has a few things; a UITabBarController controlling 3 UITableViews. Two of these TableViews are filtered versions of the 3rd. All of them will be making a JSON call (still working on that) to retrieve a list of objects.

So, because these views are related in some way, would there be a more "sane" way to display this data? With say, subviews? Or would I have to just create 1 view for each that returns the desired data and be done with it?

If it helps at all, I have full control over the API I'm talking with, so changes to that that help with this don't really matter to me too much.

Thanks in advance!

Was it helpful?

Solution

You want to minimize the number of times that you hit the server with that JSON call. Since two of the tableViews display subsets of the data contained in the third, you should be making that JSON call once and then filtering your results in memory for the two other tableViews.

One way to do this would be to create a class to make your JSON call and populate an array with the results. You could then pass a pointer to this object to your three tableView controllers. Each controller could then access the results array and filter as necessary.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top