title: swift UIButton.selected won't work
body: <p>I'm trying to keep a button selected while its audio is being played. the problem is the button won't change unless I change it in a loop (while(audioPlayer.playing){button.selcted=true}). In this case I can't use the app until audio has finished(for obvious reasons)</p>
  
  <p>hopefully someone can help me </p>
  
  <pre><code>func addButton(number: String, x:CGFloat, y:CGFloat){
  
      let button   = UIButton(type: UIButtonType.Custom) as UIButton
  
      button.setTitle(number, forState: .Normal)
  
      button.frame = CGRectMake(x, y, 68, 212)
  
      if let image  = UIImage(named: number) {
          button.setImage(image, forState: .Normal)
      }
  
      button.addTarget(self, action: "play:", forControlEvents:.TouchUpInside)
      self.view.addSubview(button)
  
  }
  
  @IBAction func play(sender: UIButton) {
      button=sender
  
      button.selected = true
  
      let audioFilePath = NSBundle.mainBundle().pathForResource(sender.currentTitle, ofType: "WAV")
  
      if audioFilePath != nil {
  
          let audioFileUrl = NSURL.fileURLWithPath(audioFilePath!)
  
          do { audioPlayer = try AVAudioPlayer(contentsOfURL: audioFileUrl, fileTypeHint: nil)} catch _ { return }
          audioPlayer?.delegate = self
          audioPlayer.play()
  
      } else {
          print("audio file is not found")
      }
  }
  </code></pre>