【发布时间】:2017-05-24 11:54:09
【问题描述】:
我有一个包含类似单元格的集合视图控制器,我希望每个单元格都打开具有特定内容的下一个视图控制器。我想我必须将 indexpath.row 与 segue 一起发送,但在这部分我面临一个错误:
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if let newViewController = segue.destination as? myCollectionViewController {
newViewController.passedValue = indexPath.row // exactly here
}
}
【问题讨论】:
-
myCollectionView.indexPathsForSelectedItems[0]? (或类似的东西) -
你不能为你的任务使用这个委托函数 didSelectRowAtIndexPath 吗?
标签: swift uicollectionview segue