Im trying to change the button icon PLAY for PAUSE when I tap on it. But my code is not working. Please help!
This is my @IBAction code.
@IBAction func playTimer(sender: AnyObject) {
if buttonSwitch == 0 {
timer = NSTimer.scheduledTimerWithTimeInterval(1, target: self, selector: Selector("result"), userInfo: nil, repeats: true)
buttonSwitch = 1
self.navigationItem.setLeftBarButtonItem(UIBarButtonItem(barButtonSystemItem: .Pause, target: self, action: "setAlarm"), animated: true)
println("2")
} else {
timer.invalidate()
buttonSwitch = 0
}
}
I tried everything but nothing's happened. No errors, the icon does not change.
Thanks.
0 comments:
Post a Comment