Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get iOS font size and set it to all labels of the app?

Tags:

I want to make an app, where font size increase or decrease according to font size maintained in iOS in Settings. If you change font size of your iOS from settings, whatsapp font size displayed accordingly, I want same functionality.

like image 389
Tejinder Avatar asked Sep 23 '16 03:09

Tejinder


1 Answers

The iOS functionality you're looking for is the Dynamic Type that only works for text with implemented text styles.

Basically, you must :

  • Use the text styles but beware, their availability depends on your iOS version.enter image description here
  • Tick the adjustsFontForContentSizeCategory property (since iOS 10) in your interface builder or implement it in code so as to tell the system to handle automatically the Dynamic Type for the object it belongs to (text styles must be used of course).
  • Adapt all your constraints to the different sizes your app may encounter.

You can also follow the notifications related to the Dynamic Typeevents as indicated below :enter image description here Everything is well explained in this WWDC video detailed summary where all the contents and their video timelapses are indicated to reach rapidly the information.

There's also the possibility of adapting the graphical elements size as well with a Dynamic Type implementation.

like image 131
XLE_22 Avatar answered Sep 22 '22 16:09

XLE_22