简体   繁体   English

iOS 6:关闭键盘快捷键

[英]iOS 6: Turn off keyboard shortcuts

Is there is any way to turn off keyboard shortcuts in iOS 6 for particular textfield/textview? 有没有办法在iOS 6中为特定的textfield / textview关闭键盘快捷键? I want to turn off keyboard shortcut for my app only and not from 'Settings app' of iOS. 我想关闭我的应用程序的键盘快捷键,而不是iOS的“设置应用程序”。

I started writing my own text editor to achieve it. 我开始编写自己的文本编辑器来实现它。

You could try turning off autocorrection for your text field or text view with its autocorrectionType property—if the shortcut functionality is included in that (which seems likely), then it should get disabled as well. 您可以尝试使用autocorrectionType属性关闭文本字段或文本视图的自动autocorrectionType - 如果快捷功能包含在其中(似乎很可能),那么它也应该被禁用。 I'm pretty sure there's no way to control the shortcut system itself; 我很确定没有办法控制快捷方式系统本身; you might consider filing an enhancement request for it. 您可以考虑为其提交增强请求

There is no standard way to turn off keyboard shortcuts on application level (For non jailbroken iOS). 没有标准方法可以在应用程序级别关闭键盘快捷键(对于非越狱的iOS)。 To achieve this I stated with implementation of custom TextView with Core Text and UITextInput protocol. 为了实现这一点,我说明了使用Core TextUITextInput协议实现自定义TextView。 Add @property for keyBoardShortCuts , Override " tokenizer " getter method by following way to turn off shortcuts. 添加@propertykeyBoardShortCuts ,覆盖“ tokenizer通过以下方式来关闭快捷键” getter方法。

- (id <UITextInputTokenizer>)tokenizer {
    if(self.keyBoardShortCuts)
        return _tokenizer;
    else
        return nil;
}

If we remove tokenizer, there is be no keyboard shortcuts in custom view, even though shortcut are turned on from iOS setting. 如果我们删除了tokenizer,即使从iOS设置打开了快捷方式,自定义视图中也没有键盘快捷键。

Note: Take care of one thing, as we are not depending on tokenizer, now, in this case, use enumerateSubstringsInRange:range options:NSStringEnumerationByWords/Lines block to find out selection range for word or line. 注意:注意一件事,因为我们不依赖于标记化器,现在,在这种情况下,使用enumerateSubstringsInRange:range选项:NSStringEnumerationByWords / Lines块来查找单词或行的选择范围。

To try this add above code in EGOTextView project to turn off default shortcuts. 要尝试此操作,请在EGOTextView项目中添加上述代码以关闭默认快捷方式。

From what I know, if you iphone is not jailbroken then you cannot turn it off for particular apps. 据我所知,如果你的iphone没有越狱,那么你就无法为特定的应用程序关闭它。 It is more like a "master setting" that if changed, change applies to everything within iOS. 它更像是一个“主设置”,如果更改,更改将适用于iOS中的所有内容。

If it jailbroken, i know there are utility apps you can download that allow you to tweak the OS in that fashion... 如果它越狱了,我知道你可以下载的实用程序应用程序允许你以这种方式调整操作系统......

Settings > General > Shortcuts. 设置>常规>快捷方式。 There are ready-made ones and any that you may have set up. 有现成的和你可能已经设置的任何一个。 They apply across all your iOS devices including your desktop Mac. 它们适用于所有iOS设备,包括桌面Mac。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM