IOS-Attributes text operations, text color changes in the TextFiel box, etc.

Source: Internet
Author: User

IOS-Attributes text operations, text color changes in the TextFiel box, etc.
Text attribute Attributes1.NSKernAttributeName: @ 10 adjust the sentence kerning adjust the sentence 2. NSFontAttributeName: [UIFont systemFontOfSize: _ fontSize] set the font 3. NSForegroundColorAttribuTeName: [UIColor redColor] set the text color 4. NSParagraphStyleAttributEName: paragraph set paragraph style 5. NSMutableParagraphStyle * paragraph = [[using alloc] init]; paragraph. alignment = NSTextAlignmentCenter; 6. NSBackgroundColorAttribuTeName: [UIColor blackColor] set the background color 7. NSStrokeColorAttributeNaMe and NSStrokeWidthAttributeNaMe sets the stroke width to make the text hollow.

NSStrokeWidthAttributeNaThe value corresponding to the me attribute 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.

Two hollow attributes are set at the same time, and NSStrokeWidthAttributeNaIf the me attribute is set to an integer, the text foreground is ineffective.

Effect:

Effect:

8. NSStrikethroughStyleAttr Add strikethrough and strikethrough to ibuteName

Effect:

9. NSUnderlineStyleAttribut Underline eName

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. NSVerticalGlyphFormAttri ButeName

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. NSObliquenessAttributeNa Me sets the font skew. Skew

Effect:

13. NSExpansionAttributeName Set text flattening

Effect:

Related Article

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.