开发者

"Filtering" Cells in a UITableView. Multiple Views? Subviews?

(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, 开发者_如何学Goso changes to that that help with this don't really matter to me too much.

Thanks in advance!


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜