mercredi 29 juin 2016

When i ckeck a checkbox all checkboxes are checked (Swift)

Hello i have a collection view in which i have a checkbox in every cell. I use this checkbox http://ift.tt/29bZyge.

All cells have their checkbox but the problem as the title says is that when i tap on the checkbox all checkboxes are checked. Actually when i tap the first all odds checkboxes (1-3-5-7-...) are checked and when i tap the second then all checkboxes are checked.

I connected the view to my cell file i change it to WOWCheckbox as the documentation says.

I didn't change anything else.

func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
        let cell = collectionView.dequeueReusableCellWithReuseIdentifier("Interest Cell", forIndexPath: indexPath) as! ThirdTabCell


        cell.check1.tag = indexPath.row
        cell.check1.addTarget(self, action: #selector(ThirdTab.follow(_:)), forControlEvents: UIControlEvents.TouchUpInside)

        return cell



    }




func follow(sender:WOWCheckbox!) {
        print("check")
    }

When i use this code when i tap a checkbox it prints check only once. I believe i somehow i have to declare which check i tap but i don't know how to use it.




Aucun commentaire:

Enregistrer un commentaire