根据iPhone尺寸的特定类型,自动布局UIButton和UILabel字体大小[不编程] [英] Autolayout UIButton and UILabel font size according to specific type of the iPhone size[NOT PROGRAMMATICALLY]
问题描述
我想根据iPhone的大小(4、4.7或5.5英寸)设置不同的字体大小
I want to set different font size according to the IPhone size (4, 4.7 or 5.5 inch) Here is one of the solution
但是我想问问有没有办法通过没有代码的界面生成器来自动调整UIButton/UILabel字体大小?例如,它如何与保持比率的宽度-UIsmth尺寸的高度一起工作? 如果没有如我所描述的那样做-设置字体大小的最佳实践是什么.我应该将其作为每个UI元素的单独文件进行处理,还是最好在适当的UI elem子类中进行处理? 具体问题-我正在编写仅适用于iPhone肖像的网络应用程序
But I want to ask is there is any way to auto resize UIButton / UILabel font size through interface builder without code? For example, how it works with holding ratio width - height of the UIsmth size? If there is no way to do it as I described - what is the best practice to set font sizes. Should I do it as separate file for each UI element or it s better to do it in the appropriate UI elem subclass? To concrete the question - I'm writing an web app for iPhone portrait only
推荐答案
是的,您可以使用sizeClass.
Yeah it's possible you can use sizeClass for it.
选择要更改sizeFont的viewController,然后
Select the viewController wich you want to change the sizeFont, then
这里:
您选择所需的sizeScreen (在您看到"any/any"的地方它将显示为蓝色),然后选择textField,转到
You select the sizeScreen you want (it will appears blue where you see "any/any" ) and then select the textField, go to the
属性检查器
Attributes inspector
,然后点击字体部分中的加号按钮以选择新的大小:
and choose a new size clicking the plus button in the font section :
您将看到类似这样的内容:
You will see something like this:
选择并更改所需的大小,它将为您服务
Select and change the size you want, It will work for you
这篇关于根据iPhone尺寸的特定类型,自动布局UIButton和UILabel字体大小[不编程]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!