简体   繁体   中英

How to reduce and increase the font size based on screen size in iOS

I want to reduce and increase the font size of the text in a UILabel based on the screen size. I'm trying to build for iPhone 5s to iPad Pro screen size (if thats possible). The labels are in a vertical stack view

You can easily do that by changing the Autoshrink property of the label from its default value of Fixed Font Size to Minimum Font Scale.

Here I have attached an image to do that:

在此处输入图片说明

To achieve this:

  1. click on the label and go to the attributes pane
  2. change the "lines" to 0
  3. In autoshrink click on minimum font size and set it to about half the size of your main font or a much smaller font

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM