Fahim Parkar
Fahim Parkar

Reputation: 31657

setting font family in font (ignoring size)

What I was trying is set font size and font family separately due to some reasons.

For setting size I used

[addressLabel setFont:[UIFont systemFontOfSize:12.0]];

However for family name I am not finding how to do that.. Any idea how to get that?

Upvotes: 0

Views: 99

Answers (1)

rmaddy
rmaddy

Reputation: 318955

You need more than just the font family, you need the font name. Once you have a font name, if you want to update the label's font to the new font with the same size, you can do:

UIFont *oldFont = addressLabel.font
UIFont *newFont = [UIFont fontWithName:someName size:oldFont.pointSize];
addressLabel.font = newFont;

Upvotes: 1

Related Questions