Attributes usage of text attributes

Source: Internet
Author: User

Text attribute attributes1.nskernattributename: @ 10 adjust the expression kerning. 2. nsfontattributename: [uifont systemfontofsize: _ fontsize] Set Font 3. nsforegroundcolorattributename: [uicolor redcolor] sets the text color 4. nsparagraphstyleattributename: paragraph set paragraph style 5. nsmutableparagraphstyle * Paragraph = [[nsmutableparagraphstyle alloc] init]; paragraph. alignment = nstextalignmentcenter; 6. nsbackgroundcolorattributename: [uicolor blackcolor] sets the background color 7. nsstrokecolorattributename: Specifies the stroke color. You need to set the stroke width with nsstrokewidthattributename to make the text hollow.

The value of nsstrokewidthattributename is an nsnumber object (decimal ). This value changes the stroke width (percentage relative to the font size ). The default value is 0. Only the width of the stroke is changed. The negative number simultaneously changes the stroke and fill width of the text. For example, for common hollow words, this value is usually 3.0.

At the same time, two hollow attributes are set, and the nsstrokewidthattributename attribute is set to an integer, so the text foreground is ineffective.

 

Effect:

Effect:

 

8. Add strikethroughstyleattributename and strikethrough

 

Effect:

 

9. Add an underscore to nsunderlinestyleattributename

 

Effect:

 

10. nsshadowattributename is used to set the shadow. It cannot be set separately. It must be used with other attributes.

And either of the three, nsverticalglyphformattributename, nsobliquenessattributename, nsexpansionattributename

 

11. nsverticalglyphformattributename

The value corresponding to this attribute is an nsnumber object (integer ). 0 indicates horizontal text. 1 indicates the vertical text. In iOS, horizontal text is always used. values other than 0 are not defined.

 

Effect:

 

12. nsobliquenessattributename sets the font skew. Skew skew

 

Effect:

 

13. nsexpansionattributename

 

Effect:

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.