iOS Foundation: system font size

Jakub picture Jakub · May 7, 2012 · Viewed 19k times · Source

I would like to know if systemFontSize in iOS app tableView is always the same for textLabel? This is are depening to style?

For example when I NSLog(@"%f",[UIFont systemFontSize]); I'm getting 14.0. Is this are always the same?

And what's more: How can i change font size without changing the font-family (assuming that i have my own fonts in my plist).

I tried:

cell.textLabel.font = [UIFont fontWithName:@"Sansation-Light" size:12.0];

But UIFont always want for me fontname/family. How can i avoid that and have one font to all my screen and changing only size?

Answer

Malek_Jundi picture Malek_Jundi · May 7, 2012

System Fonts are describe as following :

+ (CGFloat)labelFontSize;//Returns the standard font size used for labels.
+ (CGFloat)buttonFontSize;//Returns the standard font size used for buttons.
+ (CGFloat)smallSystemFontSize;//Returns the size of the standard small system font.
+ (CGFloat)systemFontSize;//Returns the size of the standard system font.

and you can change the font size without the font family like this :

cell.textLabel.font = [UIFont systemFontOfSize:14];