ios - 如何像应用商店一样显示多个表格 View Controller ?

标签 ios uitableview

App store image

我应该使用什么才能在单个 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/

相关文章:

javascript - 检测 UIWebView 中的 Javascript/Ajax 更改

ios - UITableView 异步图像加载 - 滚动之前不布局

ios - 更改 UITableView 动画的持续时间(使用表 beginUpdates 插入/删除行)

uitableview - 点击单元格时如何播放视频?

ios - 什么时候释放 UITableView 单元格中的 UIButton?

ios - 在 UITableViewCell Swift 4+ 中向 UIImageView 添加双击手势识别器

ios - 获取 NSString 中的相似字符

uitableview - 将 UISearchBarDisplayController 保持在 tableview 之上

ios - UITableviewCell 图像大小在单击单元格时发生变化?

ios - 如何在同一个类中的不同方法的方法中重用从 for 循环派生的变量?