开发者

How to show Multiple Data Source in a Single Tableview?

I have a situation where i have a single UITableView and a single UISegmentedControl with 3 bar buttons.Now my requirement is if i change the segment of segment control i want different data source to be loaded to my tableview.But i failed to achieve this, Every time i change the segment cellForRowAtIndexPath: is showing same data in my table view.

So basically what should be the approach when we have multiple data source but single instance of 开发者_运维百科table view to show the data?

should i create different table view class for for each of my segment control?

Any Tutorial is helpful for this?


Just have one nsmutablearray holding current datasource, and upon switching segments in segmented control empty the array and put new items into it, finally call [tableview reloadData] to refresh the tableview with new datasource.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜