我想基于UICollectionView中的选择来转换到不同的控制器:
override func collectionView(_ collectionView:UICollectionView,didSelectItemAt indexPath:IndexPath){
if indexPath.item == 0 && indexPath.section == 0 {
print ("Item 0 and section 0 selected")
Perform Segue to Controller1
} else if (indexPath.item == 1 && indexPath.section == 0 ){
----> Perform Segue to Controller 2
print ("Item 1 and section 0 selected")
} else {
print("Not selected ")
}
}
根据Collection View中的选择,它应该转换为不同的UiCollectionView控制器
Tried this command
self.performSegue(withIdentifier:“Selection1”,sender:self)
但它错误地说:'NSInternalInconsistencyException',原因:'无法将类视图出列:具有标识符ProductCell的UICollectionElementKindCell - 必须为标识符注册一个nib或类或连接一个故事板中的原型单元'
执行这种Segue的最佳方式是什么?请指教
谢谢
1 回答
override func collectionView(_ collectionView:UICollectionView,didSelectItemAt indexPath:IndexPath){
另外为了摆脱错误我必须更新集合可重用视图中的标识符