I have a label. But on the ipad and iphone it is displayed differently. It is necessary that the text increases on the ipad, but on the iphone it decreases. How to do it?

  • one
    Try to write more detailed questions. Explain exactly what you see the problem, how to reproduce it, what you want to get as a result, etc. - Nicolas Chabanovsky
  • font size or UILabel size? - Max Mikheyenko

2 answers 2

There are three simple options for how to do this:

  1. If you are using constraints, then bind the label to the right and left edges, and put stretching.
  2. If you are using an autoresizing mask, then do the same, bind it to the left and right, and stretch it.
  3. The simplest option is to prescribe in the code all this relative to the screen, taking as a basis the width of the screen of the device on which the [UIScreen mainScreen].bounds.size.width program will run and to set the label frame from it.

    Looks like it's about font size.

    You can use the size class for the font size. In the inspector attribute near the Font point there is a +.

    enter image description here