IOS-UI-UILable, iosuilabel automatic line feed

Source: Internet
Author: User

IOS-UI-UILable, iosuilabel automatic line feed

// Used for text display

UILabel * label = [[UILabel alloc] initWithFrame: CGRectMake (10, 30,200,300)];

// Use the color tester to select the color

Label. backgroundColor = [UIColor colorWithRed: 26/255. f green: 124/255. 0 blue: 248/255. 0 alpha: 1];

Label. text = @ "I'm from China, this is a beautiful place"; // text

Label. textColor = [UIColor whiteColor]; // font color

Label. font = [UIFont systemFontOfSize: 18]; // system font size

// Label. font = [UIFont boldSystemFontOfSize: 18]; // Add the system font to the blacklist

// Customize the font

// Label. font = [UIFont fontWithName: <# (NSString *) #> size: <# (CGFloat) #>]; // Custom font. The first parameter indicates the font name, the second parameter indicates the size.

Label. numberOfLines = 0; // line feed setting (0 indicates that the default setting is invalid)

Label. lineBreakMode = NSLineBreakByCharWrapping; // (multiple) line feed (line Break Mode)

Label. textAlignment = NSTextAlignmentLeft; // Alignment)

// You need to activate (allow Operation) to set the text

Label. shadowColor = [UIColor blackColor]; // The shadow color of the text)

Label. shadowOffset = CGSizeMake (2, 2); // shadow offset of Text

Label. enabled = NO; // whether to activate it. The default value is YES.

// Set the tag

Label. tag = 1;

// Label. transform = CGAffineTransformMakeRotation (0.4); // sets the degree of text skew (transform conversion)

[Self. view addSubview: label];

[Self setLabelText];

}

// Set to replace the new text

-(Void) setLabelText {

// Obtain the view of the tag

// UILabel * label = (UILabel *) [self. view viewWithTag: 1];

// Label. text = @ "new text ";

}

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.