Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scale text label by screen size

Tags:

xcode

ios

swift

Is there a way to scale text so that it takes up close to the same screen real estate no matter what the device size is? I've found that the text on an iPad sized device is too small in relation to the screen size when compared to the iPhone. Below is an example of what I'm looking for. Notice the text percentage size is similar in relation to the device screen size.

Example

enter image description hereenter image description here

like image 751
Jeffrey Avatar asked Mar 27 '15 19:03

Jeffrey


People also ask

How do I automatically adjust font size in HTML?

The font-size-adjust property gives you better control of the font size when the first selected font is not available. When a font is not available, the browser uses the second specified font. This could result in a big change for the font size. To prevent this, use the font-size-adjust property.

How do I change font size according to screen resolution IOS?

Go to Settings > Accessibility > Display & Text Size. Adjust any of the following: Bold Text: Display the text in boldface characters. Larger Text: Turn on Larger Accessibility Sizes, then adjust the text size using the Font Size slider.

How do I show text and display size?

On your device, open the Settings app. Search and select Display size. To change your preferred display size, move the slider left or right.

How do I resize text in CSS?

To change the size of your text with inline CSS, you have to do it with the style attribute. You type in the font-size property, and then assign it a value.


2 Answers

To set constraints on the label that you have, see this link: How do you make a background image scale to screen size in swift? . I know that you might not be using Swift (I'm using Objective-C), but the first answer shows how to do it in the storyboard. Do the same thing it says, but for the label. Then, see the image below to change the auto shrink options for the label from "Fixed Font Size" to "Minimum Font Scale" (see image below). Hope this helps!

Changing Font Size

like image 148
William Dayanayev Avatar answered Sep 25 '22 05:09

William Dayanayev


1. Select your label and open attribute inspector for it Select the UI (button, label etc)

2. Click on + sign by Font, select width and height as "Regular", click Add Variation click on + icon on side of font, select width and height regular

3. Another Font field will appear, this will represent font for ipad/big screen/ illusion of big screen (scroll view)

another font field will appear, this is for big screen (ipad or illusion of big screen by scroll view etc)

4. Select your desired font for ipad

select the desired size and font you want to show on ipad

like image 22
Kamran Bashir Avatar answered Sep 22 '22 05:09

Kamran Bashir