【发布时间】:2017-11-06 19:07:53
【问题描述】:
我在 tableView 单元格中有一个 collectionView。我想点击 collectionView 单元格并使用传入的信息转到 detailTableView。我没有太多工作。已经做了一些研究,它指出 tableView 单元格既没有故事板也没有导航控制器。我如何能够将数据传递到detailTableView。这是我的实现,可能不正确
class PopularTableViewCell: UITableViewCell {
var books = [CKRecord]()
var detailViewController: DetailViewController!
}
extension PopularTableViewCell: UICollectionViewDataSource {
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
let record = books[indexPath.row]
let storyBoard = UIStoryboard(name: "Home", bundle: nil)
if let detailVC = storyBoard.instantiateViewController(withIdentifier: "DetailVC") as? DetailViewController {
detailVC.bookRecord = record
detailViewController.navigationController?.pushViewController(detailVC, animated: true)
}
}
}
【问题讨论】:
标签: ios swift uitableview uicollectionviewcell pushviewcontroller