I want to programmatically create an UIImage filled by a solid color. Anyone have an idea of how to do this in Swift?
Ios – Create UIImage with solid color in Swift
iosswiftuiimage
iosswiftuiimage
I want to programmatically create an UIImage filled by a solid color. Anyone have an idea of how to do this in Swift?
Best Answer
Another nice solution, Swift 3.0
Swift 2.2 compatible, is to create another constructor in UIImage, in this way:
In this way you can create the custom colored-image in this way:
Or, optionally, create the image with a custom size: