checkBoxOutlet vs checkBoxOutline

xcode
(Julio) #1

I am building a todo list using xcode 10. I am following a tutorial on youtube and the guys code works well but it doesn't for me.

cell.checkBoxOutlet.setBackgroundImage(#imageLiteral(resourceName: "checkBoxFILLED "), for: UIControlState.normal)

This does not work for me, I get this error:

Value of type 'taskCell' has no member 'checkBoxOutlet'; did you mean 'checkBoxOutline'?

I am a noob so any help would be great!

(Suyash Srijan) #2

The cell probably has an IBOutlet called checkBoxOutlet and your's does not, that's why. You need to create one and link it to the checkbox in your view.

...or maybe you named your outlet checkBoxOutline, in that case you should write cell. checkBoxOutline.

(Julio) #3

Thank you, that fixed that part. Now when I try to select a background image from assets, it doesnt show up. Any ideas?

(Suyash Srijan) #4

You need to create an UIImage and pass it as an argument to setBackgroundImage(). Also, this isn't related to Swift, but UIKit, so it would be best if you post any further queries in the developer forums.