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

时间:2009-06-20 11:19:32

标签: iphone cocoa-touch

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

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

由于

1 个答案:

答案 0 :(得分:10)

看看UIColor。具体做法是:

- (void) setFill;

例如:

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

其他方法包括setStrokeset来设置填充和描边。字体使用填充颜色。