The Uilabel of ios-oc-basic control

Source: Internet
Author: User

UILabel

Essential controls in iOS development, this article lists commonly used properties and methods (note that the Xcode version is 7.2)

1. Create a Uilabel object, you can set the starting position and size when you create it, or you can

UIL. Frame = CGRectMake (100, 100, 100, 100); To set the starting position and size.

UILabel *uil=[[UILabel alloc] initwithframe: CGRectMake (+, +, + )];

2. Setting text content

UIL. text = @ "Hello,word" ;

3. Set the text color

UIL. TextColor = [uicolor orangecolor];

4. Set the alignment,

UIL. TextAlignment = Nstextalignmentleft ;

nstextalignmentleft//left Justified

nstextalignmentcenter//Center

nstextalignmentright//Right Alignment

5. Set the font size

UIL. Font =[uifont systemfontofsize:];

6. Setting the background color

UIL. BackgroundColor =[uicolor redcolor];

7. Set whether you can interact with users

UIL. userinteractionenabled = YES ;

8. Set the number of lines (if equal to 0, you can automatically wrap the content)

UIL. NumberOfLines = 2;

9. set the font size to fit the label width

UIL. Adjustsfontsizetofitwidth = YES ;


This article is from the "Red Corner Antelope" blog, please be sure to keep this source http://2254359459.blog.51cto.com/10776102/1743124

The Uilabel of ios-oc-basic control

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.