按屏幕尺寸缩放文本标签 [英] Scale text label by screen size

查看:73
本文介绍了按屏幕尺寸缩放文本标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种缩放文本的方式,以便无论设备大小如何,文本都可以占据相同的屏幕空间?我发现,与iPhone相比,iPad尺寸的设备上的文字相对于屏幕尺寸而言太小.以下是我要寻找的示例.请注意,文本百分比大小与设备屏幕大小类似.

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.

推荐答案

要在标签上设置约束,请参见以下链接:

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!

这篇关于按屏幕尺寸缩放文本标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆