How to create bold UIFont

后端 未结 4 952
陌清茗
陌清茗 2021-02-05 02:26

I am doing some word wrapping in my tableview as some of the values are so big they go off the edge of the screen.

However, the font and size and boldness dose not match

相关标签:
4条回答
  • 2021-02-05 02:41

    You have to ask for the font specifically, for example

    [UIFont fontWithName:@"Helvetica-Bold" size:17.0]
    

    Here is a list of available fonts: http://www.iphonedevsdk.com/forum/iphone-sdk-development/6000-list-uifonts-available.html

    0 讨论(0)
  • 2021-02-05 02:42

    If you're using the version of Helvetica that is bundled in iOS, you can simply do:

    [UIFont boldSystemFontOfSize:17.0];
    
    0 讨论(0)
  • 2021-02-05 02:44

    You would use:

    + (UIFont *)boldSystemFontOfSize:(CGFloat)fontSize
    

    If you provided a custom font or are using a system-provided font, you'd use the bold typeface as the name of the font:

    [UIFont fontWithName:@"Arial-BoldMT" size:17];
    
    0 讨论(0)
  • 2021-02-05 02:48

    You can look into the fontNamesForFamilyName: method.

    Specifically for Helvetica there are these families

    NSLog(@"%@", [UIFont fontNamesForFamilyName:@"Helvetica"]);
    
    "Helvetica-LightOblique",
    Helvetica,
    "Helvetica-Oblique",
    "Helvetica-BoldOblique",
    "Helvetica-Bold",
    "Helvetica-Light"
    
    0 讨论(0)
提交回复
热议问题