点击分段控制时更改表格视图。与 APPSTORE 应用程序完全相同。怎么做呢?
我有一个 SampleViewController,其中在导航栏下方的顶部添加了一个分段控件(不在其中)。现在在分段控件下方,我想要一个从另一个类 CommonTableViewController 加载的 tableView。当点击某个段时,应该加载来自同一 CommonTableViewController 的新 tableView。怎么办呢? 提前致谢。
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 segment is tapped the a new tableView from same CommonTableViewController should be loaded. How can it be done?
thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我使用数组来填充我的 tableView...
在我的 segmentedControlClicked 方法中...我根据选择的段更改数组中的数据,然后使用这行代码:
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:
如果您已经有 2 个 UITableView,则只需从屏幕上删除第一个并添加另一个即可。根据
具体情况,您可能还需要考虑拥有一个 tableView 并仅更改数据。
If you already have 2 UITableViews then just remove the first from the screen and add the other. LIke
Depending on the case, you might also want to consider haveing one tableView and just changing the data.