【发布时间】:2015-11-28 01:30:02
【问题描述】:
我希望每个 CollectionViewCell 显示图像并在被点击时隐藏标签。但是如果用户滚动图像突然显示在其他没有被触摸的进程中。如何识别某些细胞?
override func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
println("user tapped on door number \(indexPath.row)")
let cell = collectionView.cellForItemAtIndexPath(indexPath) as! MyCollectionViewCell
if (cell.myLabel.text == "1") {
one = true
if (cell.myLabel.hidden) {
cell.myLabel.hidden = false
cell.MyImageView.image = nil
}
else {
cell.myLabel.hidden = true
cell.MyImageView.image = UIImage(named:"1")!
}
}
【问题讨论】:
标签: ios swift uicollectionviewcell collectionview