How to change the title of a button inside a cell Swift
<p>I have a collection view and inside a button.
When I tap this button I want to change its name.
I managed to do it but when I tap it, it changes if I have 20 buttons 10 of them like this if I tap the first button it changes the 0,2,4,6,8 and if I tap a button which isn't in the list then all buttons are checked.</p>

<p>This is my code:</p>

<pre><code> @IBAction func following(sender: AnyObject) {
        if follow.tag == sender.tag {
        follow.setTitle("Following", forState: .Normal)
        }
        print("\(follow.tag) \(sender.tag)")
    }

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

        cell.follow.tag = indexPath.row
        return cell



        }
</code></pre>

<p>Inside button's function I tried without if statement too but again the same problem.
When I print the tags it prints only the button which was tapped.</p>

<p>I also tried this to my ViewController </p>

<pre><code>  cell.follow.addTarget(self, action: #selector(ThirdTab.follow(_:)), forControlEvents: UIControlEvents.TouchUpInside) 
//inside cellForItemAtIndexPath

     func follow(sender:UIButton!) {



        }
</code></pre>