OGeek|极客世界-中国程序员成长平台

标题: iphone - 在 UITableViewController ios 中实现另一个 TableView [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 10:55
标题: iphone - 在 UITableViewController ios 中实现另一个 TableView

我需要向我的 UITableViewController 添加一个新的表格 View ,其中将包含不同的数据和设计。

enter image description here

上面的原型(prototype)单元格是我在storyboard中添加的新表格 View ,主表格 View 是第二个包含(标题、标签和图像)的表格 View 。

是否允许在 UITableViewController 中创建另一个 TableView ,或者我应该创建一个 UIViewController 并在其中实现两个表???

其实我已经完成了第一个表格 View Controller 的实现,所以我需要实现新的。

所附图片显示了我想要的: enter image description here



Best Answer-推荐答案


如果您希望同时显示两个表,则最好使用具有两个 tableViews 作为 subview 的 UIViewControllerUITableViewController 只能在某个时间只显示一个 tableView 时使用。

您可以有一个 UIViewController 作为两个 tableViews 的 dataSourcedelegate,或者有一个 UITableViewController 并将它们作为 subview 添加到 UIViewController 这将是它们的容器 View 。后者可能会为您节省一些时间来调试可能的问题,因为具有单个 delegate/dataSource 的两个 tableViews 需要在同一个地方有很多重复的代码。

关于iphone - 在 UITableViewController ios 中实现另一个 TableView ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16481140/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4