如何使文本标签在不同的Apple产品屏幕上缩放字体大小? [英] How do I make text labels scale the font size with different Apple product screens?
问题描述
link1 (没有足够的代表实际张贴照片)
所有我想要做的是确保结果标签缩放到大致相同的比例为每个不同的屏幕尺寸。正如你在下面看到的,这个差别在3.5屏幕和iPad屏幕之间是非常明显的:
所以我想让iPad屏幕上的标签足够大在3.5屏幕上的空间的百分比,垂直和水平。我怎么去做这个?我已经经历了其他几个教程/解决方案,但是他们都教给你一些不同的东西,比如如何改变标签大小,而不是字体大小。我尝试添加宽高比约束,但是只改变它而不改变字体大小。添加高度/宽度约束条件也只会更改不带字体大小的标签大小。
实际上,您可以在Storyboard中执行此操作。
1,在故事板上打开File Inspector选项卡(第一个选项卡),设置使用自动布局
和使用大小类
检查。
然后你可以去你的标签属性(Forth标签),你会注意到有一个+旁边,点击它来添加。
3,选择你想要的屏幕大小,可以参考Adaptivity and Layout,然后选择字体大小。
请参阅此链接,你也可以看看
This is for ios dev with swift. I have a very simplistic layout:
link1 (not enough rep to actually post the pic)
All I'm trying to do is make sure that "results" label scales to roughly the same proportion for each different screen size. As you can see below, the difference is extremely noticeable between a 3.5 screen and an iPad screen:
So I want to make the label on the iPad screen big enough to take up the same percentage of space as it does on the 3.5 screen, both vertically and horizontally. How do I go about doing this? I've been through several other tutorials/solutions, but they all teach you something different like how to change the label size, but not the font size. I tried adding the aspect ratio constraint, but that only shifts it around without changing the font size. Adding a height/width constraint also only changes the label size without the font size.
You can actually do it in your Storyboard.
1, open File Inspector tab(First tab) on your storyboard, set both Use auto layout
and Use size classes
check.
2, Then you can go to your label attribute(Forth tab), you will notice that there is a "+" beside, click it to add.
3, Choose the screen size u want like, can refer "Adaptivity and Layout" and then select your font size.
Answer refer to THIS LINK, you can also take a look
这篇关于如何使文本标签在不同的Apple产品屏幕上缩放字体大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!