我正在使用此解决方案(https://stackoverflow.com/a/25786928)来检测Settins应用程序(iOS 8)中激活的所有自定义键盘:
- (void)printoutAllActiveKeyboards {
// Array of all active keyboards
NSArray *keyboards = [[[NSUserDefaults standardUserDefaults] dictionaryRepresentation] objectForKey:@"AppleKeyboards"];
for (NSString *keyboard in keyboards)
NSLog(@"Custom keyboard: %@", keyboard);
}但这是不够的,我的项目-我需要知道哪一个自定义键盘是由用户当前选择的文本输入。我有研究堆栈溢出和其他资源,但没有找到任何解决方案。有没有办法在我的应用程序中检测当前选择了哪个自定义键盘进行文本输入?
谢谢!
发布于 2014-12-18 04:19:38
看看这个禁用自定义键盘的UIApplication接口方法:
- (BOOL)application:(UIApplication *)application shouldAllowExtensionPointIdentifier:(NSString *)extensionPointIdentifier {
if ([extensionPointIdentifier isEqualToString: UIApplicationKeyboardExtensionPointIdentifier]) {
return NO;
}
return YES;
}也许您可以修改UIApplicationKeyboardExtensionPointIdentifier的值以满足您的需要
https://stackoverflow.com/questions/27457559
复制相似问题