adman
adman

Reputation: 408

Disabling a Button in Swift

So I'm new to Swift, but trying to figure out how to disable this button when it is pressed. I have the following:

@IBAction func IBbtnUpdateTap(sender: UIButton){

    if imageNumber == 0 {
        IBbtnUpdateTap.enabled = false
    }

I'm not sure why it's giving me problems. Any ideas?

Upvotes: 0

Views: 102

Answers (1)

tuledev
tuledev

Reputation: 10327

IBbtnUpdateTap isn't the button. The button is sender

 @IBAction func IBbtnUpdateTap(sender: UIButton){

    if imageNumber == 0 {
        sender.enabled = false
    }

Upvotes: 3

Related Questions