【发布时间】:2021-10-13 12:01:54
【问题描述】:
我想将一些数据从一个集合视图传递到另一个集合视图,但出现以下错误:
无法转换类型“[IndexPath]?”的值到预期的参数类型'Int'
当我按下一个单元格时,我想向另一个集合视图显示一些数据。
这是代码。
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
performSegue(withIdentifier: "showItems", sender: self)
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if let destination = segue.destination as? ItemsViewController
{
///Below is the error
destination.items = guys[collectionView.indexPathsForSelectedItems]
}
}
【问题讨论】:
标签: ios swift uicollectionview