禁用智能报价的NSTextView仍会替换引号 [英] NSTextView with Smart Quotes disabled, still replaces quotes

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

问题描述

我有一个NSTextView禁用了智能报价选项:





但是,如果我输入:



'hello世界'



在textview中,它会被替换为:



'hello world'



(看看单引号是如何替换的)。



我认为禁用智能引号会照顾这一点,它似乎没有帮助。

解决方案

您可以通过以下方法禁用NSTextView的智能引号: / p>

  self.textView.automaticQuoteSubstitutionEnabled = NO; 

在OS X 10.9 Mavericks中,不设置界面构建器中的复选标记似乎不起作用。 / p>

请参阅 NSTextView setAutomaticQuoteSubstitutionEnabled:



此外,您可以使用此功能进行更详细的控制文本替换。

  self.textView.enabledTextCheckingTypes = 0; 

请参阅NSTextView setEnabledTextCheckingTypes:



此外,在Mavericks中,默认情况下在系统首选项→键盘→文本中启用智能报价。您可以将此设为个人偏好设置。


I have a NSTextView with the 'Smart Quotes' option disabled:

However, if I were to type:

'hello world'

Into the textview, it instanly gets replaced with:

‘hello world’

(see how the single quotes have been replaced).

I thought disabling smart quotes would have taken care of this, but it does not seem to of helped. Any suggestions on how I can get these prettier quotes to go away?

解决方案

You can disable smart quotes for your NSTextView with:

self.textView.automaticQuoteSubstitutionEnabled = NO;

Not setting the checkmark in the interface builder doesn't seem to work since OS X 10.9 Mavericks.

See NSTextView setAutomaticQuoteSubstitutionEnabled:

Also you can use this for a more detailed control over the text replacement.

self.textView.enabledTextCheckingTypes = 0;

See NSTextView setEnabledTextCheckingTypes:

Also in Mavericks there is smart quotes enabled by default in System Preferences → Keyboard → Text. You can disable this as a personal preference.

这篇关于禁用智能报价的NSTextView仍会替换引号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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