Created
October 18, 2022 05:29
-
-
Save nicolas-miari/07381078067be59d7b00eef74c3f1c8f to your computer and use it in GitHub Desktop.
UIImage Create Solid
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (nullable UIImage *)sampleImage { | |
CGRect bounds = CGRectMake(0, 0, 50, 50); | |
UIColor *color = [UIColor colorWithDisplayP3Red:1 green:0.5 blue:0.25 alpha:1]; | |
UIGraphicsBeginImageContextWithOptions(bounds.size, NO, 0); | |
[color setFill]; | |
UIRectFill(bounds); | |
UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); | |
UIGraphicsEndImageContext(); | |
return image; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment