1
votes

In iOS 8 in order to get Helvetica Neue in the thin variation the following code would work

UIFont.systemFontOfSize(50, weight: UIFontWeightThin)

In iOS 9 the system font changed to San Francisco, so I can no longer do this. I absolutely must use Helvetia in this app and can't figure out how to set the font weight. This is the code I am currently using.

    timeSelectedLabel.font = UIFont(name: "Helvetica Neue", size: CGFloat(50))

I know there is a constructor which accepts a UIFontDescriptor. Not sure how to use that though. Any thoughts are appreciated!

Note: Before you mark this as duplicate know that the only 2 posts are either unanswered or don't currently work.

2
"I absolutely must use Helvetia in this app" why not download Helvetica Neue font from a font website and define and use it in your app?Sam B
You need to purchase it from the company where as it is already built into the system.Big_Mac

2 Answers

5
votes

All I had to do was specify the weight after a dash like so.

UIFont(name: "HelveticaNeue-Thin", size: CGFloat(50))
0
votes

In Swift 3, you could simply set this as:

textLabel?.font = UIFont(name: "Avenir-Medium", size: 10)!

There's no need to set the size using the CGFloat parameter.