码迷,mamicode.com
首页 > 移动开发 > 详细

iOS之CATextLayer属性简介

时间:2017-11-01 16:35:19      阅读:458      评论:0      收藏:0      [点我收藏+]

标签:结束   tla   属性   bsp   渲染   star   anti   居中   getter   

1、CATextLayer简介

  CATextLayer快速高效简单地来渲染纯文本、NSAttributedString

/* The text layer provides simple text layout and rendering of plain
 * or attributed strings. The first line is aligned to the top of the
 * layer. */

NS_ASSUME_NONNULL_BEGIN

CA_CLASS_AVAILABLE (10.5, 2.0, 9.0, 2.0)
@interface CATextLayer : CALayer
{
@private
    struct CATextLayerPrivate *_state;
}

//渲染的字符串
@property(nullable, copy) id string;

//字体
@property(nullable) CFTypeRef font;

//字号
@property CGFloat fontSize;

//文字颜色
@property(nullable) CGColorRef foregroundColor;

//是否换行,默认NO
@property(getter=isWrapped) BOOL wrapped;

//枚举:设置截断模式
@property(copy) NSString *truncationMode;

//枚举:设置对其模式
@property(copy) NSString *alignmentMode;

//文字是否像素化,默认NO
@property BOOL allowsFontSubpixelQuantization;

@end

/* Truncation modes. */

CA_EXTERN NSString * const kCATruncationNone    //不剪裁,默认
CA_AVAILABLE_STARTING (10.5, 3.2, 9.0, 2.0);
CA_EXTERN NSString * const kCATruncationStart   //剪裁开始部分
CA_AVAILABLE_STARTING (10.5, 3.2, 9.0, 2.0);
CA_EXTERN NSString * const kCATruncationEnd     //剪裁结束部分
CA_AVAILABLE_STARTING (10.5, 3.2, 9.0, 2.0);
CA_EXTERN NSString * const kCATruncationMiddle  //剪裁中间部分
CA_AVAILABLE_STARTING (10.5, 3.2, 9.0, 2.0);

/* Alignment modes. */

CA_EXTERN NSString * const kCAAlignmentNatural  //默认
CA_AVAILABLE_STARTING (10.5, 3.2, 9.0, 2.0);
CA_EXTERN NSString * const kCAAlignmentLeft     //左对齐
CA_AVAILABLE_STARTING (10.5, 3.2, 9.0, 2.0);
CA_EXTERN NSString * const kCAAlignmentRight    //右对齐
CA_AVAILABLE_STARTING (10.5, 3.2, 9.0, 2.0);
CA_EXTERN NSString * const kCAAlignmentCenter   //居中对齐
CA_AVAILABLE_STARTING (10.5, 3.2, 9.0, 2.0);
CA_EXTERN NSString * const kCAAlignmentJustified    //两端对齐
CA_AVAILABLE_STARTING (10.5, 3.2, 9.0, 2.0);

NS_ASSUME_NONNULL_END

 

iOS之CATextLayer属性简介

标签:结束   tla   属性   bsp   渲染   star   anti   居中   getter   

原文地址:http://www.cnblogs.com/xianfeng-zhang/p/7766874.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!