iOS 11 - 禁用智能引号 [英] iOS 11 - disable smart quotes

查看:236
本文介绍了iOS 11 - 禁用智能引号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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 .yes .no 。目前没有关于这些值的进一步文档,但 .yes .no 是不言自明的。我对 .default 的猜测是系统将使用诸如 textContentType isSecureTextEntry <等属性/ code>确定适当的行为。

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 - 禁用智能引号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆