jeudi 23 avril 2015

Method 'setChecked' with Objective-C selector 'setChecked:' conflicts with setter for 'checked' with the same Objective-C selector

I have created custom class that inherits from UIButton.

In that class I have created a function defined as:

  func setChecked(checked:Bool){
        self.checked = checked
        if checked {
            buttonImageView.image = UIImage(named: "radioSelected.png")
        } else {
            buttonImageView.image = UIImage(named: "radioUnselected.png")
        }
    }

which was working fine until I updated my xCode to 6.1.3.

Now I keep getting the error message on the function definition line:

Method 'setChecked' with Objective-C selector 'setChecked:' conflicts with setter for 'checked' with the same Objective-C selector

I already tried to make a override it but then I get a error saying that "Method does not override any method from its superclass".

Anyone know how can I correctly solve it?

(I don't want to change the name of my function.)

Aucun commentaire:

Enregistrer un commentaire