0
我有一个tableViewCell,其中我有一个TableView,它又有一个tableViewCell。如何访问最内层的tableView和tableViewCell以向其添加数据?我正在尝试做一些类似Facebook的评论页面。如何将数据添加到TableViewCell内部的TableView中
任何帮助将不胜感激。 谢谢。
我有一个tableViewCell,其中我有一个TableView,它又有一个tableViewCell。如何访问最内层的tableView和tableViewCell以向其添加数据?我正在尝试做一些类似Facebook的评论页面。如何将数据添加到TableViewCell内部的TableView中
任何帮助将不胜感激。 谢谢。
你可以这样做:
class mainTableViewController: UITableViewController {
//your functions here
}
//你的自定义单元格类
class yourCustomCell:UITableViewCell,UITableViewDataSource,UITableViewDelegate{
@IBOutlet weak var innerTableView : UITableView?
var myArray : Array<Any> = []
override func awakeFromNib() {
super.awakeFromNib()
innerTableView?.dataSource = self
innerTableView?.delegate = self
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return myArray.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = UITableViewCell.init(style: .default, reuseIdentifier: "identifier")
return cell
}
}
可以请我解释一下,如何将数据从maintableViewController传递到yourCustomCell以显示数据 –
我相信这个问题的回答将帮助你http://stackoverflow.com/questions/17398058/ is-it-it-it-add-uitableview-within-a-uitableviewcell –