Drawing checkbox NSString with UIKit does not match fill color

I'm trying to make a check mark in green using UIKit, but it is drawn in black instead. Here is the code:

[[UIColor greenColor] set];
[@"✔" drawAtPoint:CGPointZero withFont:[UIFont systemFontOfSize:[UIFont systemFontSize]]];

      

Other lines are correctly drawn in green with this method. I suspect there is color information in the checkbox that overrides my fill color, but draws the same character with the color in the UIWebView.

Is there a way to get the check mark in green?

+2


source to share


1 answer


I suspect this checkbox may not be available in the system font and the text system is doing its best to fulfill your request using a different font (this probably comes from ZapfDingbatsITC). In the process, perhaps the color becomes stripped.



One thing you can try is to turn this glyph into a bezier path and then fill it with your desired color.

+3


source







All Articles