如何在 iOS 的主故事板中适应每个设备的字体大小?

How to fit a font size on each device in Main storyboard of iOS?

我想为每个设备调整字体大小。 UI 是为 iPhone 8 创建的。所以字体大小是14。但其他手机看不到所有字母,因为屏幕很小。我该如何调整?

Main.storyboard

https://useyourloaf.com/blog/size-classes/ <= 我试图通过参考这个网站来解决问题,但帮不了我。

故事板无法做到这一点。您只能使用代码,在您的代码中使用屏幕边界检查设备类型。并为每个屏幕尺寸更改字体大小。

更新: 你可以这样试试

let screenWidth = UIScreen.main.bounds.size.width
if screenWidth == 640 {
   // iPhone 4inch and 3.5inch. Smaller than iPhone 8
   // Call change font
}