UIStringDrawing更改字体颜色 - 可可触摸

Ben*_*ves 3 iphone cocoa-touch

UIFont似乎没有管理颜色,有没有办法使用UIStringDrawing.h或具体改变字体颜色:

- (CGSize)drawInRect:(CGRect)rect withFont:(UIFont *)font
Run Code Online (Sandbox Code Playgroud)

谢谢

Ed *_*rty 10

看看UIColor.特别:

- (void) setFill;
Run Code Online (Sandbox Code Playgroud)

例如:

[[UIColor redColor] setFill];
[myString drawInRect:rect withFont:font];
Run Code Online (Sandbox Code Playgroud)

其他方法包括setStroke并且仅set设置填充和描边.字体使用填充颜色.