- (void)drawInRect:(CGRect)rect withAttributes:(NSDictionary *)attrs
作用:在view上绘画字体(重绘通常是在uiview或是其子类时,在drawRect中使用).
参数解析:第一个参数rect,即待绘画字体的坐标;第二个参数attrs:即字体的属性,是一个字典型数据,里面存放字体的属性的键值对,e.g:字号16,字体颜色:
NSDictionary *attribute = [NSDictionarydictionaryWithObjectsAndKeys:[UIFontsystemFontOfSize:15.0f], NSFontAttributeName, [UIColorredColor], NSForegroundColorAttributeName, nil];
[@"股市走势图"drawInRect:CGRectMake(100,200, 60, 20)withAttributes:attribute] ;
还有那些属性可以放到第二个参数的字体里面,可以根据自己的需要添加,各属性值见链接:http://www.cnblogs.com/qingche/p/3574995.html