Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIStringDrawing Change font color - cocoa touch

UIFont doesn't appear to manage color, is there a way to change the font color using UIStringDrawing.h or specifically:

- (CGSize)drawInRect:(CGRect)rect withFont:(UIFont *)font

Thanks


1 Answers

Take a look at UIColor. Specifically:

- (void) setFill;

For example:

[[UIColor redColor] setFill];
[myString drawInRect:rect withFont:font];

Other methods include setStroke and just set to set both fill and stroke. Fonts use the fill color.

like image 84
Ed Marty Avatar answered Jan 30 '26 20:01

Ed Marty



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!