1, Catextlayer Introduction
Catextlayer fast, efficient and simple to render plain text, nsattributedstring
/*The text layer provides simple text layout and rendering of plain * or attributed strings. The first line was aligned to the top of the * layer. */ns_assume_nonnull_beginca_class_available (10.5,2.0,9.0,2.0)@interfacecatextlayer:calayer{@private structCatextlayerprivate *_state;}//the rendered string@property (nullable, copy)ID string;//Font@property (nullable) cftyperef font;//Font Size@property cgfloat fontSize;//text color@property (nullable) Cgcolorref Foregroundcolor;//whether the line is wrapped, the default no@property (getter=iswrapped) BOOL wrapped;//enumeration: Setting truncation Mode@property (copy) NSString *Truncationmode;//enumeration: Setting the mode to its@property (copy) NSString *Alignmentmode;//text is pixelated, default no@property BOOL allowsfontsubpixelquantization;@end/*truncation modes.*/Ca_extern NSString*ConstKcatruncationnone//no clipping, defaultCa_available_starting (10.5,3.2,9.0,2.0); Ca_extern nsstring*ConstKcatruncationstart//Trim Start SectionCa_available_starting (10.5,3.2,9.0,2.0); Ca_extern nsstring*ConstKcatruncationend//Trim End SectionCa_available_starting (10.5,3.2,9.0,2.0); Ca_extern nsstring*ConstKcatruncationmiddle//Trim middle sectionCa_available_starting (10.5,3.2,9.0,2.0);/*Alignment modes.*/Ca_extern NSString*ConstKcaalignmentnatural//defaultCa_available_starting (10.5,3.2,9.0,2.0); Ca_extern nsstring*ConstKcaalignmentleft//Align LeftCa_available_starting (10.5,3.2,9.0,2.0); Ca_extern nsstring*ConstKcaalignmentright//Align RightCa_available_starting (10.5,3.2,9.0,2.0); Ca_extern nsstring*ConstKcaalignmentcenter//Center AlignmentCa_available_starting (10.5,3.2,9.0,2.0); Ca_extern nsstring*ConstKcaalignmentjustified//Justify on both sidesCa_available_starting (10.5,3.2,9.0,2.0); Ns_assume_nonnull_end
Introduction to the Catextlayer properties of iOS