1. Property name
1 > NSFontAttributeName (font)
The value corresponding to this property is a UIFont object. This property is used to change the font of a paragraph of text. If this property is not specified, the default is 12-point Helvetica(Neue).
2 > NSParagraph Style Attribute Name (paragraph)
The value corresponding to this property is an NSParagraphStyle object. This attribute applies multiple attributes to a paragraph of text. If this property is not specified, the default paragraph property returned by the defaultParagraphStyle method of NSParagraphStyle is default.
Examples:
NSString *exchange = [NSString stringWithFormat:@"Applicable:%@", red.memo]; NSMutableAttributedString *exchangeAttr = [[NSMutableAttributedString alloc] initWithString:exchange]; // paragraph style NSMutableParagraphStyle * paragraphStyle = [[NSMutableParagraphStyle alloc] init]; // Row spacing paragraphStyle.lineSpacing = 4.0; // Non-first line indentation paragraphStyle.headIndent = 33; [exchangeAttr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, exchange.length - 1)]; self.explainLB.attributedText = exchangeAttr;
Effect:
// Paragraph Style @property(readwrite) CGFloat lineSpacing; //Row spacing @property(readwrite) CGFloat paragraphSpacing; //paragraph spacing @property(readwrite) NSTextAlignment alignment; //Text alignment format @property(readwrite) CGFloat firstLineHeadIndent; //text-indent @property(readwrite) CGFloat headIndent; //Non-line indentation @property(readwrite) CGFloat tailIndent; //End-of-line indentation @property(readwrite) NSLineBreakMode lineBreakMode; //Hidden way of paragraph text overflow @property(readwrite) CGFloat minimumLineHeight; //Minimum row height @property(readwrite) CGFloat maximumLineHeight; //Maximum row height @property(readwrite) NSWritingDirection baseWritingDirection;//Paragraph Writing Direction @property(readwrite) CGFloat lineHeightMultiple; //Multiline height @property(readwrite) CGFloat paragraphSpacingBefore;//Spacing before paragraph @property(readwrite) float hyphenationFactor; //English hyphen //2. Enumeration of NSText Alignment Text Alignment Alignment (IOS6 or above is valid): NSTextAlignmentLeft //be at the left side NSTextAlignmentRight //be at the right NSTextAlignmentCenter //Centered NSTextAlignmentNatural //default NSTextAlignmentJustified //Self-adjustment //3. Writing direction of NSWriting Direction (IOS6 or above is valid): NSWritingDirectionNatural //Direction Definition Using Bidi Algorithmic Rules P2 and P3 NSWritingDirectionLeftToRight //right NSWritingDirectionRightToLeft //From right to left
3 > NSForegroundColorAttributeName (font color)
The value corresponding to this property is a UIColor object. This property is used to specify the font color of a paragraph of text. If this property is not specified, it defaults to black.
4 > NSBackgroundColorAttributeName (font background color)
The value corresponding to this property is a UIColor object. This property is used to specify the background color of a paragraph of text. If this property is not specified, no background color is defaulted.
5 > NSLigatureAttributeName (hyphen)
The value corresponding to this attribute is an NSNumber object (integer). Conjoined characters refer to some characters that are connected together.
They use a single symbol. 0 means that there are no conjoined characters. 1 denotes the use of default hyphenated characters. 2 denotes the use of all conjoined symbols. The default value is 1 (note, iOS The unsupported value is 2.
6 > NSKernAttributeName (word spacing)
The value corresponding to this attribute is an NSNumber object (integer). Alphabetical tightness specifies the number of pixels used to adjust the pitch. The effect of tightly arranged letters depends on the font. A value of 0 means that no alphabetical tightness is used. The default value is 0.
7 > NSStrikethrough StyleAttributeName (deleted line)
The value corresponding to this attribute is an NSNumber object (integer). This value specifies whether to add a delete line to the text, and refers to "Underline Style Attributes". The default value is NSUnderline StyleNone.
8 > NSUnderline Style Attribute Name (underscore)
The value corresponding to this attribute is an NSNumber object (integer). This value specifies whether to underline the text, referring to "Underline Style Attributes". The default value is NSUnderline StyleNone.
9 > NSStrokeColorAttributeName
The value corresponding to this property is a UIColor object. If this property is not specified (default), it is equivalent to NSForegroundColorAttributeName.
Otherwise, specify a delete line or underline color.
10 > NSStrokeWidthAttributeName (Side Width)
The value corresponding to this attribute is a NSNumber object (decimal). This value changes the stroke width (as a percentage of font size). The default is 0, i.e. unchanged. Positive numbers only change the stroke width.
Negative numbers change both the describing edge and the filling width of the text. For example, for common hollow words, this value is usually 3.0.
11 > NSShadow Attribute Name (Shadow)
The value corresponding to this attribute is an NSShadow object. The default is nil.
12 > NSVertical Glyph FormAttribute Name (horizontal and vertical typesetting)
The value corresponding to this attribute is an NSNumber object (integer). 0 represents horizontal text. 1 represents vertical text. In iOS, horizontal text is always used, and values other than 0 are undefined.