我想选择全部并取消选择Preferences - General
的所有单元格,使用全选并取消全选collectionView
?
请帮助任何人。
UIButton
谢谢
答案 0 :(得分:1)
尝试按照以下步骤进行操作 -
var isSelectAll=false
func collectionView(collectionView: UICollectionView,
cellForItemAtIndexPath indexPath: NSIndexPath) ->
UICollectionViewCell
{
//Get a reference to our storyboard cell
let cell = collectionView.dequeueReusableCellWithReuseIdentifier(
"pickSomecell",
forIndexPath: indexPath)
//Show Images in grid view
if isSelectAll {
cell.cellImage.image = selectedImage;
}else{
cell.cellImage.image = desselectedImage;
}
return cell
}
@IBAction func selectAllcell(sender: AnyObject) {
isSelectAll=true
collectionView.reloadData()
}
@IBAction func deselectAllcell(sender: AnyObject) {
isSelectAll=false
collectionView.reloadData()
}