skip to Main Content

I am trying to change the the image of a button when i click it and I’m using the method below:

    @IBOutlet weak var firstCard1: UIButton!
    
    @IBAction func firstCard(_ sender: UIButton) {
    let blueCard = UIImage(named: "blue_back")
    firstCard1.setImage(blueCard, for: .normal)
}

I get an error on line 4 on the

for: .normal

It says

Editor placeholder in source file.

2

Answers


  1. Clean and then build the project, which can be done with the following keyboard shortcuts:

    ⌘ command + shift + K then ⌘ command + shift + B

    Login or Signup to reply.
  2. Either delete the line of code and re write it or clean and build your project

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search