如何在单个视图中实现多个uitableview?
问题描述:
有谁能告诉我如何在一个视图中显示多个UITableView?
Can anyone tell me how I can show multiple UITableViews in a single view?
答
1)使用绘制不同的表视图不同的帧/拖放不同大小的表视图,如果使用XiB。
1) Draw different table views using different frames/ Drag and drop table views of different sizes, if using XiB.
2)照常遵守表视图协议并为委托/数据源方法提供实现
2) Conform to table view protocols as usual and give implementation for delegate/datasource methods
3)在委托/数据源方法中,使用表视图的对象决定调用哪个表视图。例如:
3) In the delegate/datasource methods decide for which table view, it was called, using the table view's object. for example:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;
{
if(tableView == tableView1)
{
//Do this
}
else if(tableView == tableView2)
{
//Do that
}
}