48

I'm trying to set a font programmatically. I want to use System Semibold like I'm using in the interface builder. Been looking for it on the list of fonts. Do I need to use

[myButton.titleLabel setFont:[UIFont fontWithName:@"Helvetica-Semibold" size:13.0]]

?

Cœur
  • 34,719
  • 24
  • 185
  • 251
KexAri
  • 3,767
  • 5
  • 38
  • 74

3 Answers3

170

The system font for iOS, starting in iOS 9, is "San Fransisco." To get a semibold version, you could use something along the lines of:

Swift 2.2:

UIFont.systemFontOfSize(20, weight: UIFontWeightSemibold)

Swift 3.0:

UIFont.systemFont(ofSize: 20, weight: UIFontWeightSemibold)

Swift 4.0:

UIFont.systemFont(ofSize: 20, weight: .semibold)

For more information on this, see the UIFont Class Reference.

Jeff Lewis
  • 2,765
  • 1
  • 17
  • 23
6

To further assist you these are the official names of all the helvetica fonts that apple currently supports as taken directly from the Apple website: https://support.apple.com/en-us/HT202771

Helvetica 
Helvetica Bold 
Helvetica Bold Oblique 
Helvetica Light 
Helvetica Light Oblique 
Helvetica Neue 
Helvetica Neue Bold 
Helvetica Neue Bold Italic 
Helvetica Neue Condensed Black 
Helvetica Neue Condensed Bold 
Helvetica Neue Italic 
Helvetica Neue Light 
Helvetica Neue Light Italic 
Helvetica Neue Medium 
Helvetica Neue Medium Italic 
Helvetica Neue Thin 
Helvetica Neue Thin Italic 
Helvetica Neue UltraLight 
Helvetica Neue UltraLight Italic 
Helvetica Oblique 
logixologist
  • 3,704
  • 4
  • 26
  • 45
0

I think there is no default font with name Helvetica-Semibold you can add custom font to your projects for reference stack link 1 stack link 2

Community
  • 1
  • 1
Anshad Rasheed
  • 2,376
  • 1
  • 13
  • 32