UIButton Learning Knowledge points

Source: Internet
Author: User

UILabel (label): is a control provided in iOS that is used to display text, inheriting from UIView. Core Features: Display text

UIView: is the base class for the views provided in iOS, provides common properties of the view and public methods, and does not have specific functionality (display text, input text, etc.).

1. Create a View object

UILabel *alabel = [[UILabel alloc] Initwithframe:cgrectmake (30, 100, 300, 100)];

2. Configuring related properties

Alabel.backgroundcolor = [Uicolor Yellowcolor];

2.1 Display text

Alabel.text = @ "Ming Ming xi Huan wo, que bu gao su wo, wo xiang jingjing, jingjingshihshui,ni xian gao su wo mingming shi Shui ";

2.2 Text color

Alabel.textcolor = [Uicolor Redcolor];

2.3 How text is aligned

Alabel.textalignment = Nstextalignmentcenter;

2.4 Set label multi-line display

Alabel.numberoflines = 0; 0 is no limit to the number of rows

2.5 Set how lines are intercepted (line break mode)

Alabel.linebreakmode = nslinebreakbywordwrapping;

2.6 Shadow Color (text shadow)

Alabel.shadowcolor = [Uicolor Bluecolor];

2.7 Shadow offset (change the distance between shadow and solid word)

Alabel.shadowoffset = Cgsizemake (3, 3);

2.8 Text font (font style and size)

2.8.1 use system style to change font size

Alabel.font = [Uifont systemfontofsize:12]; 12 is the font size

2.8.2 use bold style to change font size

Alabel.font = [Uifont boldsystemfontofsize:15];

2.8.3 modifying font styles and font sizes

Alabel.font = [Uifont fontwithname:@ "Zapfino" size:13];

3. Add to Parent View

[Self.window Addsubview:alabel];

4. Release of ownership

[Alabel release];

UIButton Learning Knowledge points

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.