问题描述
我想知道是否允许在同一个视图中使用多个 UItableView (我没有看到任何东西在 Apple的人机界面指南!),如果可以,如何在中加载 DataSource in viewDidLoad 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在同一个视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!