0

I want to adjust font size for each device. The UI is created for iPhone 8. So the font size is 14. But other phones don't see all the letters because the screen is small. How do I adjust this?

Main.storyboard

storyboard one

storyboard one_1

https://useyourloaf.com/blog/size-classes/ <= I tried to solve the problem by referring to this site, but couldn't help me.

Syed Ali Salman
  • 2,894
  • 4
  • 33
  • 48
iosbegindevel
  • 307
  • 5
  • 20
  • Have you enabled "Use Trait Variation" on your storyboard? Check the "Attributes Inspector Trait Variations" section of this article. https://www.techotopia.com/index.php/Using_Trait_Variations_to_Design_Adaptive_iOS_User_Interfaces#Attributes_Inspector_Trait_Variations – Ishara Amarasekera Sep 03 '19 at 02:32

1 Answers1

0

You can't do it with storyboard. You only can with code, in your code you check device type using bounds of screen. And change font size for each screen size.

UPDATE: You can try like this

let screenWidth = UIScreen.main.bounds.size.width
if screenWidth == 640 {
   // iPhone 4inch and 3.5inch. Smaller than iPhone 8
   // Call change font
}
Thanh Vu
  • 1,599
  • 10
  • 14