Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I find out if a UIColor is pattern-based?

Suppose I want to set the background image for a UIView; apparently I do this by calling [UIColor colorWithPatternImage]. Is there any way to determine if a UIColor object has been initialized in this way, i.e., if it is a pattern rather than a solid color?

like image 304
Dan Tao Avatar asked Feb 22 '23 16:02

Dan Tao


1 Answers

You could try calling CGColorGetPattern(color.CGColor). This function doesn't document what happens if the color is not a pattern color, but it's reasonable to expect that it will return NULL,

like image 71
Lily Ballard Avatar answered Feb 26 '23 21:02

Lily Ballard