Correctly set the font of the catextlayer

Source: Internet
Author: User

In iOS, uifont is usually used to set fonts, except catextlayer. For more information, see catextlayer class reference,

May be eitherCtfontref,
Cgfontref, An instance
Nsfont(Mac OS X only), or a string naming the font. In iOS, you cannot assign
UifontObject To this property. defaults to Helvetica.

TheFontProperty is only used whenString
Property is notNsattributedstring.

Note:If the font property isCtfontref,
Cgfontref
, Or an instanceNsfont, The font size of the property is ignored.

Set the catextlayer Font:

Error: textlayer. font = [uifont fontwithname: @ "HiraKakuProN-W3" Size: 12];
Correct: textlayer. font = @ "HiraKakuProN-W3"; textlayer. fontsize = 12;

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.