问题描述
iOS 11在输入时添加了智能引号。在macOS中,我们可以通过设置禁用 NSTextView
上的智能引号:
iOS 11 adds smart quotes when typing. In macOS we can disable smart quotes on a NSTextView
by setting:
textView.automaticQuoteSubstitutionEnabled = NO;
UITextField
或 UITextView
似乎具有此属性或enabledTextCheckingTypes属性。如何在iOS 11上禁用智能报价?
Neither UITextField
or UITextView
seem to have this property or the enabledTextCheckingTypes property. How can smart quotes be disabled on iOS 11?
推荐答案
智能报价和其他功能(如智能破折号)通过 UITextInputTraits
协议由两者采用 UITextField
和 UITextView
。
Smart quotes and other features such as smart dashes are controlled via the UITextInputTraits
Protocol which is adopted by both UITextField
and UITextView
.
具体来说, smartQuotesType
属性可以设置为 .default $之一c $ c>,
.yes
或 .no
。目前没有关于这些值的进一步文档,但 .yes
和 .no
是不言自明的。我对 .default
的猜测是系统将使用诸如 textContentType
和 isSecureTextEntry 确定适当的行为。
Specifically, the smartQuotesType
property can be set to one of .default
, .yes
or .no
. At this time there is no further documentation on these values, but .yes
and .no
are self-explanatory. My guess on .default
is that the system will use properties such as textContentType
and isSecureTextEntry
to determine the appropriate behaviour.
例如,文本内容类型的电子邮件,密码或URL默认情况下可能会禁用智能引号,而作业标题可能默认启用。我想安全文本输入字段也会默认禁用智能。
For example a text content type of email, password or URL would probably disable smart quotes by default while job title may default to enabled. I imagine secure text entry fields would also have smarts disabled by default.
为输入视图设置合适的文本内容类型可以显着改善用户体验,强烈建议您这样做。
Setting an appropriate text content type for your input views can significantly improve the user experience and is highly recommended.
这篇关于iOS 11 - 禁用智能引号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!