Hi there I using a segmented control on a view. With the help of this segmented control I would like to display to different tables on my view, Suppose I have two segments in my table on tap of segment 1 I would like to display table 1 and on tap of segment 2 I would like to display table 2 my table 1 is a Plain table and table 2 is a grouped table, Apple is using approach to display differnt apps in differnt categories on app store but I am not sure how do I do that. Please suggest any approach or any code sample for the same will also appriciated.
Thanks
Sandy
We do this by having a single tableview, and then doing an if/case statement in each tableview callback method to return the right data based on which value is selected in the segmented control.
First, add the segmentedControl to the titleView, and set a callback function for when it is changed:
Next, when the segmented control is changed, you need to load the data for the new segment, and reset the table view to show this data:
Then in your tableView callbacks, you need to have logic per segment value to return the right thing. I’ll show you one callback as an example, but implement the rest like this:
That’s about it, hope it helps.