-1

I have this so far and don't know what to do next.I currently have a button in my view controller with an image (play image) and want to change it to pause image when clicked.

import UIKit
import AVFoundation

class VesuviusViewController: UIViewController {


@IBOutlet weak var PausePlay: UIButton!



@IBAction func playPressed(sender: AnyObject) {
    VesSet()

}
yzet00
  • 401
  • 7
  • 23

2 Answers2

1

Try to add it inside your button click action

sender.setImage(UIImage(named: "play.png")!, forState: .Normal)
Ashish Kakkad
  • 23,586
  • 12
  • 103
  • 136
0
  @IBAction func playPressed(sender: AnyObject) {
    VesSet()



        sender.selected = !_btnCheckbox.selected;//put the appropriate  login of swift to do that 

        //checkbox
        sender.setImage(UIImage(named: "play.png")!, forState: .Normal)

       sender.setImage(UIImage(named: "pause.png")!, forState: .selected)


    }
Kandhal Bhutiya
  • 198
  • 1
  • 9