- (void)drawInRect:(CGRect)rect withAttributes:(NSDictionary *)attrs;使用

来源:互联网 发布:苏州软件行业协会 编辑:程序博客网 时间:2024/04/30 10:23

- (void)drawInRect:(CGRect)rect withAttributes:(NSDictionary *)attrs;

这个方法是ios7.0以后才能用的,如果程序支持ios7.0一下,需要判断手机系统版本,用各自的方法

- (CGSize)drawInRect:(CGRect)rect withFont:(UIFont *)font lineBreakMode:(NSLineBreakMode)lineBreakMode alignment:(NSTextAlignment)alignment;

旧方法直接在参数中设置绘制文字的属性,新方法是放到字典attrs中;

关于字典attrs 下面的链接非常详细

iOS- 详解文本属性Attributes:http://www.cnblogs.com/qingche/p/3574995.html

可以参考对文本属性进行设置;


0 0