Question

While using Interface builder & iOS7 UIFontTextStyleHeadline I set my headline label to UIFontTextStyleHeadline

(I guess it can be done also with the following code:)

myHeadlineTextLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleHeadline];

Q: this works well, yet I would like to have the same functionality only using HelveticaNeue-Thin

just as an example:

titleCustomLabel.font = [UIFont fontWithName:@"HelveticaNeue-Thin" size:(**Dynamic font size as the user defined in his setting**)];

what would be an elegant way to do so?

Was it helpful?

Solution

UIFont has the fontSize property. You can make use of that.

titleCustomLabel.font = [UIFont fontWithName:@"HelveticaNeue-Thin" size:[UIFont preferredFontForTextStyle:UIFontTextStyleHeadline].pointSize];

(don't use fontSize at the end)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top