2017-08-09 2 views
0

UICollectionViewがあります。UIButtonをタップした後、すべてを選択したり、すべてのアイテム/セルをクリアしようとします。UIButtonアクションメソッドですべてを選択して項目やセルを消去する方法

どのように私はそのような画像を行うことができますか?あなたは、あなたが選択プロパティに1つの以上のフィールドを追加することができモデルを使用している場合は、1つの選択のための配列かを管理する必要がありそのために

enter link description here

答えて

1

@IBAction func selectAll(_ sender: UIButton) { 
    // Set Whole Array to 1 and reload collection view. 
} 

@IBAction func clearAll(_ sender: UIButton) { 
    //Set Whole array to 0 and reload collection View 
} 


// In collectionView method Check selection condition and Display Check mark. 
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { 
    // If Array value is 1 at indexPath.row then set Checked view otherwise Unchecked view. 
    } 
+0

ありがとうございました。それは私のために問題をslove。 –

関連する問題