简体   繁体   English

如何使用故事板为不同的iPhone屏幕尺寸设置不同的字体大小?

[英]How to set different Font sizes for different iPhone screen size using storyboard?

I have a title in my screen whose font size is 16 but in iPhone 5s/4s it looks slightly bigger, so I want to adjust font size based on different iPhone screen size. 我的屏幕上有一个标题,其字体大小为16但在iPhone 5s / 4s中它看起来略大,所以我想根据不同的iPhone屏幕尺寸调整字体大小。 Is it possible via storyboard? 是否可以通过故事板?

yes, you can ask iOS to adapt automatically, BUT using Apple directions. 是的,您可以要求iOS自动适应,但使用Apple方向。 By the way apple states: (since ios7) 顺便说一下苹果说:(自ios7起)

https://developer.apple.com/ios/human-interface-guidelines/visual-design/typography/ https://developer.apple.com/ios/human-interface-guidelines/visual-design/typography/

1) "Use built-in text styles whenever possible." 1)“尽可能使用内置文本样式。” (algorithm is form apple..) (算法是形式苹果..)

2) "Dynamic Type provides additional flexibility by letting readers choose their preferred text size." 2)“动态类型通过让读者选择他们喜欢的文本大小来提供额外的灵活性。”

So Apple has already took in account all variations on devices and fonts and user preferences. 因此,Apple已经考虑了设备,字体和用户偏好的所有变化。 (maybe is NOT what you want.. but is the official way to scale / adapt fonts) (也许不是你想要的......但是缩放/调整字体的官方方式)

By using xCode you can give dynamic font like this way check bellow image 通过使用xCode,你可以像这样给动态字体检查波纹管图像

  1. Click on "+" button near font setting in image you can see that 点击图片中字体设置附近的“+”按钮即可看到
  2. select size of scree and assign font type and size. 选择scree的大小并指定字体类型和大小。

Setup Font 设置字体

在此输入图像描述

After setting up 设置完成后

在此输入图像描述

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Xcode Storyboard - 如何在不同的iPhone屏幕尺寸之间更改元素的字体大小和位置 - Xcode Storyboard - How to change font size and position of elements between different iPhone screen sizes 如何使用Xcode Storyboard为不同的设备设置不同的字体大小? - How to set different font sizes for different devices using Xcode Storyboard? 如何使用单个演示图板为不同的屏幕尺寸(例如,iPhone 3.5”,4”,4.7”和5.5”)设置不同的约束? - How Can I set different Constraint for different Screen sizes (For Ex: iPhone 3.5“,4”,4.7“ and 5.5”) using a single storyboard? 如何在不同的iPhone / iPad屏幕尺寸下预览Main.storyboard? - How preview Main.storyboard in different iphone/ipad screen sizes? 如何为不同的屏幕尺寸设置不同的字体,例如iPhone 6s和iPhone SE - how to set different font for different screen size, such as iPhone 6s and iPhone SE 如何在情节提要中为不同iPhone的UILabel设置不同的字体大小 - How to set different font size for UILabel for different iPhones in storyboard 为iPhone 5和iPhone 6设置不同的字体大小 - Set different font size for iPhone 5 and 6 如何在情节提要中为按钮名称的文本设置不同的字体大小 - how to set different font size to text of button name in storyboard StoryBoard不同屏幕尺寸的iOS - StoryBoard Different screen sizes iOS 如何在iOS中为各种iPhone屏幕尺寸调整字体大小? - How to adjust font size for various iPhone screen sizes in iOS?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM