Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS Foundation: system font size

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?

like image 662
Jakub Avatar asked May 07 '12 14:05

Jakub


People also ask

What is the system font of iOS?

SF Pro is the system font in iOS and iPadOS. iOS and iPadOS apps can also use NY.

What is iOS font size?

The size of your fonts when designing for iOS should be no less than 11 pts to maintain legibility on the iPhone, iPad and Apple Watch. This is the minimum value of the font size, however, you will find that the ideal value lies in the range of 15–19 pt.

Can you change the system font on iPhone?

To manage installed fonts, go to Settings > General, then tap Fonts.

What is the standard font size for application?

Minimum font size for other typefaces may vary depending on their characteristics. For example, fonts that have very thin strokes require a larger size for body text. Also, WCAG 2.0 standards recommend following the minimum font size of 18pt and 14pt for Bold text.


3 Answers

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];
like image 147
Malek_Jundi Avatar answered Sep 29 '22 10:09

Malek_Jundi


System font sizes are not always the same. Beginning in iOS 7 there is Dynamic Type. Users can set their preferred font size in the system settings. This is the recommended way for apps to get and set their font sizes now.

In the Interface Builder you can choose things like Body or Title 1 under the Font settings. The actual size will be adjusted according to the user's system settings. Programmatically you use UIFont.preferredFont(forTextStyle: ). See this post for more details about doing this in iOS 10 and Swift 3.

See also

  • Typography docs
  • Text Programming Guide for iOS
like image 33
Suragch Avatar answered Sep 29 '22 11:09

Suragch


Just to add to the above answer. The above methods are members of UIFont class. So to get the default button font size...

float defaultFontSize = [UIFont buttonFontSize]; 
like image 41
Agnit Avatar answered Sep 29 '22 10:09

Agnit