iPhone:停用“双击空格键”。捷径? [英] iPhone: Disable the "double-tap spacebar for ." shortcut?

查看:259
本文介绍了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屋!

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