UIColor from an image pattern

suggest change

You can create a UIColor object using an image pattern with the UIColor(patternImage:) initializer. UIImage(named:) is nil when the image is missing, and the force-unwrap below crashes in that case.

btn.backgroundColor = UIColor(patternImage: UIImage(named: "image")!)

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents