开发者

Change the table View when segmented Control is tapped. Exactly as in APPSTORE app. How to do it?

I am having a SampleViewController in which a segmentedControl is added at the top below nav bar(not inside it).Now below the segmentedControl i want a tableView which loads from another class CommonTableViewController. When a segme开发者_如何学Pythonnt is tapped the a new tableView from same CommonTableViewController should be loaded. How can it be done? thanks in advance.


I use an array to populate my tableView...

In my segmentedControlClicked method... I change the data in the array based on which segment was selected and then use this line of code:

[self.tableView reloadData];


If you already have 2 UITableViews then just remove the first from the screen and add the other. LIke

[tableView1 removeFromSuperview];
[self.view indertSubview:tableView2 atIndex:self.view.subviews.count];

Depending on the case, you might also want to consider haveing one tableView and just changing the data.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜