同一个视图中的两个 UITableView [英] Two UITableView in the same view

查看:47
本文介绍了同一个视图中的两个 UITableView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否允许在同一个视图中使用多个 UItableView(我在 Apple 的人机界面指南),如果没问题,如何在 DataSource 中加载不同的 DataSource每个UITableView?

I want to know if it's allowed to use Multiple UItableView in the same View (i don't see any thing in the Apple's Human Interface Guidelines) and if it's OK, How to load different DataSource in viewDidLoad for each UITableView?

推荐答案

您当然可以拥有多个表视图.您会希望确保每个指针都有一个指针,然后在您的数据源方法中,您将执行以下操作:

You can most certainly have multiple table views. You would want to make sure you keep a pointer around to each one, then in your data source methods, you would do something like this:

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
     if(tableView == tableViewOne)
           return 5;
     else //if (tableView == tableViewTwo)
           return 3;
}

这对于所有委托/数据源方法都是一样的,这就是为什么它们将哪个表视图作为参数提供给您.

This would be the same for all delegate / data source methods, which is why they give you which table view as a parameter.

这篇关于同一个视图中的两个 UITableView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆