views:

17

answers:

1

Hi all,

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?

+1  A: 

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.

dusker
Hi dusker,thanks for the help i follow what you said and finally able to crack the problem.
raaz