2016.01.18 UILabel

Source: Internet
Author: User

How to import fonts in a project

1. Import the downloaded fonts to the file

2. Add fonts to the plist file

3. If you do not choose to add to the project at the time of import, you need to add the imported fonts to the Project->build phases->copybundleresources.

4. Open the font in the mac , the title is the corresponding font name

Automatically determines the size of the Uilabel display based on content:

1. Determine the size of a container

A.width or height side fixed

B. Variable variables should be large enough eg: (300, 2000) (it is worth mentioning that if the range is not large enough, it will be truncated, and there is no ellipsis, but if the string is long enough and the range is large enough, it will exceed the screen)

2. Determine the calculated font

3. Call the Boundingrectwithsize method

Label.numberoflines = 0; Here is a multi-line display

To set the line wrapping method:

Label.linebreakmode = uilinebreakmodemiddletruncation;

enum {

Uilinebreakmodewordwrap = 0,

Uilinebreakmodecharacterwrap,

Uilinebreakmodeclip,

Uilinebreakmodeheadtruncation,

Uilinebreakmodetailtruncation,

Uilinebreakmodemiddletruncation,

} Uilinebreakmode; (truncation is the meaning of truncation, generally this is used in single-line display)

Set the shadow (this is the text and shadow)

Label.shadowcolor = [Uicolor Redcolor];

Label.shadowoffset = Cgsizemake (1.0,1.0);

It is worth mentioning that if you want to add a shadow to the entire space, to use the Layer property, all the visual effects on the UIView are implemented with this.

2016.01.18 UILabel

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.