title: change button image when play completes swift
body: <p>sender button changes when i click play button but when i click another button in the tableview the button first button image not changes to play</p>
  
  <pre><code> @IBAction func playSound(sender: UIButton) {
  if self.player != nil &amp;&amp; self.player.playing {
              player.stop()
              sender.setImage(UIImage(named: "play.png"), forState: UIControlState.Normal)            
          }
  else {
  sender.setImage(UIImage(named: "pause.png"), forState: UIControlState.Normal) 
  }
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/To2xN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/To2xN.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/tWffZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tWffZ.png" alt=""></a></p>