ios - 打开和关闭自动更正类型 (UITextView)
<p><p>我有一个 UITextView,我希望能够为其切换 autocorrectionType。</p>
<p>像这样简单地切换 autocorrectionType 是行不通的。</p>
<pre><code>myTextView.autocorrectionType = UITextAutocorrectionTypeYes;
myTextView.autocorrectionType = UITextAutocorrectionTypeNo;
</code></pre>
<p>我用过</p>
<pre><code>myTextView.text = myTextView.text;
</code></pre>
<p>和</p>
<pre><code>;
;
</code></pre>
<p>和</p>
<pre><code>;
</code></pre>
<p>这些都不起作用...</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>当您更改此类属性(包括键盘类型)时,您通常必须“启动”该过程</p>
<pre><code>// Original
myTextView.autocorrectionType = UITextAutocorrectionTypeYes;
</code></pre>
<p>...//时间流逝</p>
<pre><code>// Now want to change
myTextView.autocorrectionType = UITextAutocorrectionTypeNo;
BOOL bogusKeyboardMotion = YES; // ivar
;
;
bogusKeyboardMotion= NO;
</code></pre>
<p>然后忽略委托(delegate)方法中的任何委托(delegate)消息。也许将委托(delegate)设置为 nil 然后将其设置回来也可以。</p></p>
<p style="font-size: 20px;">关于ios - 打开和关闭自动更正类型 (UITextView),我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/20077288/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/20077288/
</a>
</p>
页:
[1]