Ios 我在UICollectionViewCell中有复选框图像,我想显示为选中还是未选中?
我想使用全选和全选Ios 我在UICollectionViewCell中有复选框图像,我想显示为选中还是未选中?,ios,swift,grid,uicollectionview,Ios,Swift,Grid,Uicollectionview,我想使用全选和全选ui按钮来全选和全选collectionView的所有单元格? 请帮助任何人 //Delegate Method cellForItemAtIndexPath func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { //Get a reference to our st
ui按钮来全选和全选collectionView
的所有单元格?
请帮助任何人
//Delegate Method cellForItemAtIndexPath
func collectionView(collectionView: UICollectionView,
cellForItemAtIndexPath indexPath: NSIndexPath) ->
UICollectionViewCell
{
//Get a reference to our storyboard cell
let cell = collectionView.dequeueReusableCellWithReuseIdentifier(
"pickSomecell",
forIndexPath: indexPath) as! pickSomeGridViewController
//Show Images in grid view
cell.cellImage.image = self.arrAllOriginalImages[indexPath.row] as? UIImage
cell.toggleSelected()
//return cell.
return cell
}
谢谢试着做以下事情-
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()
}
你的意思是你在UICollectionViewCell中有复选框图像,你想显示为选中或未选中?是@BhumitMehta,但我想一起选择所有图像。你能在CellForItemAtIndexPath中发布你的代码吗?是的,当然@BhumitMehta ThanksOk,让我试试。谢谢。