Luk*_*ski 8 objective-c ios ios8 ios-app-extension custom-keyboard
我正在使用此解决方案(/sf/answers/1805084991/)来检测在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);
}
Run Code Online (Sandbox Code Playgroud)
但这对我的项目来说还不够 - 我需要知道用户当前选择哪个自定义键盘进行文本输入.我有研究stackoverflow和其他资源,但没有找到任何解决方案.有没有办法在我的应用程序中检测当前选择的文本输入中的哪个自定义键盘?
谢谢!
det*_*man -2
看一下这个UIApplication
禁用自定义键盘的 API 方法:
- (BOOL)application:(UIApplication *)application shouldAllowExtensionPointIdentifier:(NSString *)extensionPointIdentifier {
if ([extensionPointIdentifier isEqualToString: UIApplicationKeyboardExtensionPointIdentifier]) {
return NO;
}
return YES;
}
Run Code Online (Sandbox Code Playgroud)
也许您可以修改 的值UIApplicationKeyboardExtensionPointIdentifier
来满足您的需求
归档时间: |
|
查看次数: |
806 次 |
最近记录: |