iOS7下的drawInRect的新方法drawInRect:withAttributes:使用
UIFont *font = [UIFontfontWithName:@"HelveticaNeue-Bold"size:30.0f];
UIColor *redColor = [UIColorredColor];
NSString *myString =@"I learn Really Fast";
[myStringdrawAtPoint:CGPointMake(20,100) withAttributes:@{NSFontAttributeName:font,NSForegroundColorAttributeName:redColor}];
其中withAttributes:的参数是一个属性字典,该字典的key可以在NSAttributedString.h文件中获得
在该文件中给出了使用提示。例如:
UIKIT_EXTERN NSString *const NSFontAttributeNameNS_AVAILABLE_IOS(6_0); // UIFont, default Helvetica(Neue) 12
该key是NSFontAttributeName,value是一个UIFont类型的对象。在使用时就可以将该键值对添加到字典中就可以了。在其他的地方使用到withAttributes:使用方法相同。
/************************ 字符串属性 Attributes ************************/
http://blog.csdn.net/miaoshichang/article/details/38866055