ios “自动调整字体需要使用动态类型文本样式”警告是什么意思?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/43766513/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 09:06:15  来源:igfitidea点击:

What does the "automatically adjusts font requires using a dynamic type text style" warning mean?

iosswiftstoryboardxcode8

提问by K. Law

I am getting the following warning:

我收到以下警告:

"automatically adjusts font requires using a dynamic type text style"

“自动调整字体需要使用动态类型文本样式”

Screenshot added

添加了截图

Which I can not get rid of the warning is on main.storyboard.

我无法摆脱的警告是对的main.storyboard

I have checked every UILabelin the Identity Inspectorto make sure the "Automatically Adjusts Font"is unchecked.

我已经检查每一个UILabelIdentity Inspector,以确保“自动调节字体”没有被选中。

采纳答案by K. Law

It seems to have been a bug in Xcode. This is what I did to fix it:

这似乎是Xcode中的一个错误。这是我为修复它所做的:

  1. Change the font in the label that showed the error, to a dynamic type, as suggested
  2. Select check box for "Automatically Adjusts Font"
  3. Build and run the project (the error disappears)
  4. Uncheck the "Automatically Adjusts Font" box
  5. Change the font back to the previous setting that caused the error
  6. Rebuild the project
  1. 按照建议将显示错误的标签中的字体更改为动态类型
  2. 选中“自动调整字体”复选框
  3. 构建并运行项目(错误消失)
  4. 取消选中“自动调整字体”框
  5. 将字体改回导致错误的先前设置
  6. 重建项目

The error is still gone.

错误仍然消失了。

回答by ayalcin

  1. Open your storyboard as Source Code
  2. Search for key "adjustsFontForContentSizeCategory"
  3. Check which object has this option and uncheck Dynamic Type checkbox from interface builder.
  1. 打开你的故事板作为源代码
  2. 搜索键“adjustsFontForContentSizeCategory”
  3. 检查哪个对象具有此选项并从界面构建器中取消选中动态类型复选框。

回答by Hyman

I just changed Text style to Body& Warning vanishes.

我只是改变文本样式,以身体和警告消失。

It's Just because it is dynamic type textStyle

只是因为它是动态类型的textStyle

See list of predefined supported dynamic type textStyle -

查看预定义支持的动态类型 textStyle 列表 -

enter image description here

在此处输入图片说明

回答by Spilly

I had the same problem. Even after I opened the storyboard as source and removed the "adjustsFontForContentSizeCategory" key, saved and cleaned the project it would still show.

我有同样的问题。即使我打开故事板作为源并删除“adjustsFontForContentSizeCategory”键,保存并清理它仍然会显示的项目。

So then I:

那么我:

  1. Cleaned the project
  2. Closed Xcode
  3. Deleted the derived data folder contents
  4. Re-Opened Xcode and rebuilt
  1. 清理了项目
  2. 关闭 Xcode
  3. 删除了派生数据文件夹内容
  4. 重新打开Xcode并重建

It was gone. :)

它不见了。:)

回答by Donovan King

If the "Automatically adjusts font" box is checked with a non dynamic font this warning will appear. Either uncheck the box on the offending label or use a dynamic font type.

如果使用非动态字体选中“自动调整字体”框,则会出现此警告。取消选中违规标签上的复选框或使用动态字体类型。

enter image description here

在此处输入图片说明

回答by ScottyBlades

  1. Open your storyboard, right click storyboard in file navigator.
  1. 打开您的故事板,在文件导航器中右键单击故事板。

enter image description here

在此处输入图片说明

  1. Search for (command F) and delete instances of adjustsFontForContentSizeCategory="YES"
  1. 搜索(命令 F)并删除 adjustsFontForContentSizeCategory="YES"