I have found one similar question to this but it did not answer my question.
I have a UIButton
which is animating from the bottom of the screen to the top. I would like to be able to use the button while it is moving. Now, the button can only be used when the animation has finished and the button is no longer animating. Also, I've heard that I might need to use something called NSTimer
?
class ViewController: UIViewController {
@IBAction func button2(sender: UIButton) {
button.hidden = false
button.center = CGPointMake(126, 380);
UIView.animateKeyframesWithDuration(3, delay: 0, options: .AllowUserInteraction,
animations: { () -> Void in
self.button.center = CGPointMake(126, 130 )
}) { (_) -> Void in
}
}
@IBOutlet var label: UILabel!
@IBOutlet var button: UIButton!
@IBAction func button1(sender: UIButton) {
button.hidden = true
label.hidden = false
}
override func viewDidLoad() {
super.viewDidLoad()
button.hidden = true
label.hidden = true
}
}