-2
我正在使用Swift 3为选定项目获取indexPath
。代码看起来像这样。indexPathsForSelectedItems不会在Swift 3上返回IndexPath
override func prepare(for segue: UIStoryboardSegue, sender: Any?)
{
let indexPaths = collectionView.indexPathsForSelectedItems!
print(indexPaths)
}
但是这一次打印出空数组如[]
而不是集合视图细胞的选定的项目的阵列。我如何获得所选单元格的indexPath
行?
您是否取消选择所选代表功能中的项目? – Tj3n
你需要显示你的'didSelectItemAt indexPath'方法。 –
我选择了委托功能。但它仍然返回零数组。 – fzlrhmn