iPhone:禁用“双击空格键".捷径? [英] iPhone: Disable the "double-tap spacebar for ." shortcut?
本文介绍了iPhone:禁用“双击空格键".捷径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
默认情况下,如果您在 iPhone 或 iPad 上按两次空格键,则不会出现 "(两个空格),你会得到. "(句号后跟空格).有没有办法在代码中禁用这个快捷方式?
By default, if you tap the spacebar twice on the iPhone or iPad, instead of getting " " (two spaces), you get ". " (a period followed by a space). Is there any way to disable this shortcut in code?
更新:通过 UITextInputTraits 禁用自动更正不起作用.
Update: Disabling autocorrection via UITextInputTraits doesn't work.
更新 2:明白了!见下面我的帖子.
Update 2: Got it! See my post below.
推荐答案
好的,我想通了.在您的 UITextView 委托中,添加:
OK, I figured it out. In your UITextView delegate, add this:
-(BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {
if([text isEqualToString:@". "])
return NO;
}
这篇关于iPhone:禁用“双击空格键".捷径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文