【发布时间】:2019-09-09 16:04:41
【问题描述】:
我想将数据从一个集合视图选定的单元格传递到同一视图控制器中的另一个集合视图标签。这是我的视图控制器代码
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath){
if collectionView == self.questionCollectionView {
userPressedAnswer.append(modelData[indexPath.row])
let cell = collectionView.cellForItem(at: indexPath) as? AnswerCollectionViewCell
//cell?.answerAlphabet.isHidden = false
print(modelData[indexPath.row])
} else {
print("hello")
}
}
【问题讨论】:
-
yourCollectionView.reloadData()如果它不起作用,请将其放在此块中:DispatchQueue.main.async {yourCollectionView.reloadData()}
标签: ios swift uicollectionview