A.s.ALI
A.s.ALI

Reputation: 2082

how to make app with the Dynamic type support?

I have completed making an IOS app. Now its been final and was ready to upload, but suddenly I was given a task to apply a new thing in the app and that is as Under

When user increases text size From the Settings > Accessibility > Larger Text or from Settings > Display And Brightness > TextSize now my app text appearance must change accordingly.

What I want: As I told you above that app is completed, and as I have used too many UILabels, UIButtons and UITextViews, so I am finding a way to how to change their text size accordingly to newly changed text size by the user. Is it possible to add any extension that increase the text size of app in more generic way. so that I do not have to go to every view in storyboard to make the view of dynamic type.

The process of changing and converting every view or coding in every class will be cumbersome. Is there any short way to handle it while everything is already completed.

Please help thanks.

Upvotes: 2

Views: 1269

Answers (1)

XLE_22
XLE_22

Reputation: 5671

The process of changing and converting every view or coding in every class will be cumbersome. Is there any short way to handle it while everything is already completed.

I'm sorry to tell you that implementing the Dynamic Type feature in an already existing app is never easy and quick to be done. It's like making the design, it takes time and requires conception for adapting the ergonomic a11y to provide the best user experience.

Even if many things can be done in the Interface Builder, I prefer to handle everything in code because you can mutualize many properties and methods while it's element by element in the IB.

Among other things, you'll have to:

  • Use the text styles and activate the adjustsFontForContentSizeCategory properties of your elements to have an automatic update of your system font size.
  • Listen to the traitCollectionDidChange method that belongs to the UITraitEnvironment informal protocol to be aware of the font size settings changes.
  • Use dynamic values for adapting all your constraints so as to reorder appropriately every single element and make the containers fit their contents according to the different font size settings.
  • Adapt and customize every Large Content Viewers to enlarge UI elements when the Dynamic Type can't be applied (only since iOS 13).

There's no magic trick to make an app with the Dynamic Type support: you have to know how it works and then build every element as you do in your daily programming.

Hereunder few links that may help to reach your goal:

All these information could help you make your app with the Dynamic Type support.

Upvotes: 3

Related Questions