Set UIButton Image

Hi,
Whenever I try to set a button's background image using the code below, the image goes blank instead of it changing. Ideas?

Code Block
@IBAction func showSaveCatDescript(_ sender: Any) {
if showingSaveCatDescript == false {
toggleShowSaveCatDescript.setImage(UIImage(named: "questionmark.circle.fill"), for: .normal)
saveCatDescript.isHidden = false
showingSaveCatDescript = true
}else if showingSaveCatDescript == true {
toggleShowSaveCatDescript.setImage(UIImage(named: "questionmark.circle"), for: .normal)
saveCatDescript.isHidden = true
showingSaveCatDescript = false
}
}


Answered by Claude31 in 668209022
I think you have to use systemName

Code Block
toggleShowSaveCatDescript.setImage(UIImage(systemName: "questionmark.circle.fill"), for: .normal)

Accepted Answer
I think you have to use systemName

Code Block
toggleShowSaveCatDescript.setImage(UIImage(systemName: "questionmark.circle.fill"), for: .normal)

Yes, that worked. Thank You!
Set UIButton Image
 
 
Q