UIlabel Property Text

Source: Internet
Author: User

UILabel *plabel = [[UILabel alloc] Initwithframe:cgrectmake (0,100,200,100)];

Plabel.text = @ "Test to";

Nsinteger leght = [Plabel.text length];

nsmutableattributedstring *richtext = [[Nsmutableattributedstring alloc] initWithString:pLabel.text];

Set the size, color, and font of special fields

[RichText addattribute:nsfontattributename Value:[uifont boldsystemfontofsize:16.0] Range:NSMakeRange (0, Leght)];// Set Font size

[RichText addattribute:nsforegroundcolorattributename Value:[uicolor Redcolor] Range:nsmakerange (0, Leght)];// Set Font Color

[RichText addattribute:nsobliquenessattributename value:@1 range:nsmakerange (0, Leght)];//set is italic

[RichText addattribute:nsunderlinestyleattributename Value:[nsnumber numberwithinteger:nsunderlinestyledouble] Range:nsmakerange (0, Leght)];//set underline

[RichText addattribute:nsstrikethroughstyleattributename Value:[nsnumber Numberwithinteger:nsunderlinestylesingle ] Range:nsmakerange (0,leght)];//set strikethrough

[RichText addattribute:nsstrikethroughcolorattributename Value:[uicolor Whitecolor] Range:NSMakeRange (0, Leght)];// Set the color of strikethrough

Property parameters

Nsfontattributename//font default is number 12th

nsparagraphstyleattributename//paragraph Style

nsforegroundcolorattributename//Specifying Font Color

nsbackgroundcolorattributename//Font background color

nsligatureattributename//conjoined characters

nskernattributename//Pixel of kerning

nsstrikethroughstyleattributename//add strikethrough on specified word

nsunderlinestyleattributename//the specified word and underline

nsstrokecolorattributename//Fill Part Color

nsstrokewidthattributename//Fill Width

nsshadowattributename//Shadow

nsunderlinecolorattributename//Underline color

UIlabel Property Text

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.