我应该使用什么才能在单个 View Controller 中显示多个 TableView Controller ...很像 App Store?
最佳答案
保留 3 个 UITableView 并不是什么好主意,因为您已经必须声明 3 个 NSMutableArray 来填充这些 tableView。您可以获得相同的功能,而不是使用多个 TableView,而是使用不同的 NSMutableArray 来填充单个 UITableView。
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if (isPaid)
{
return [self.arrayForPaidApps count];
}
else if(isFree) {
return [self.arrayForFreeApps count];
}
else {
return [self.arrayForTopApps count];
}
}
同样适用于 cellForRowAtIndexPath:
和 didSelectRowAtIndexPath:
方法,您将获得所需的东西。
只需在点击付费、免费或总收入应用程序时重新加载表格即可。
关于ios - 如何像应用商店一样显示多个表格 View Controller ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12801020/