iOS开发Core Animation的CATextLayer的使用

CATextLayer详解

CATextLayer提供了简单的文本布局 文本渲染的图层类

一.属性

@property(nullable, copy) id string;

文本只能是NSString或者NSAttributedString.默认为nil

@property(nullable) CFTypeRef font;

字体可以是CTFontRef,CGFontRef 或者字符串命名的字体.默认为Helvetica字体 只有在使用字符串的属性不是 NSAttributedString

@property CGFloat fontSize;

字体大小,默认为36.只有在使用字符串的属性不是 NSAttributedString. Animatable (Mac OS X 10.6 and later.)

@property(nullable) CGColorRef foregroundColor;

用foregroundColor颜色画string,默认为不透明的白色.只有在使用字符串的属性不是 NSAttributedString.Animatable (Mac OS X 10.6 and later.)

@property(getter=isWrapped) BOOL wrapped;

默认为No.当Yes时,字符串自动适应layer的bounds大小

@property(copy) NSString *truncationMode;

设置缩短的部位:kCATruncationNone,kCATruncationStart,kCATruncationEnd,kCATruncationMiddle

@property(copy) NSString *alignmentMode;

设置字体的排列格式:kCAAlignmentNatural,kCAAlignmentLeft,kCAAlignmentRight,kCAAlignmentCenter,kCAAlignmentJustified

参考资料:
CATextLayer

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值