以编程方式检测在我的 iPhone 设置中设置的所有键盘?
Programmatically detect all keyboards which are set in my iPhone settings?
我怎么知道我的 iPhone 键盘设置启用了多少键盘。
即使用户从应用商店下载了其他自定义键盘,我仍然希望以编程方式出现在列表中。
NSArray *keyboards = [[[NSUserDefaults standardUserDefaults] dictionaryRepresentation] objectForKey:@"AppleKeyboards"]; // Array of all active keyboards
NSLog(@"List of all keyboards : %@",keyboards);
您可以询问当前的第一响应者(UITextField、UISearchBar 等)。
// 假设您有实例变量指向当前进入的搜索栏
UITextInputMode *inputMode = [self.searchBar textInputMode];
NSString *lang = inputMode.primaryLanguage;
我怎么知道我的 iPhone 键盘设置启用了多少键盘。
即使用户从应用商店下载了其他自定义键盘,我仍然希望以编程方式出现在列表中。
NSArray *keyboards = [[[NSUserDefaults standardUserDefaults] dictionaryRepresentation] objectForKey:@"AppleKeyboards"]; // Array of all active keyboards
NSLog(@"List of all keyboards : %@",keyboards);
您可以询问当前的第一响应者(UITextField、UISearchBar 等)。
// 假设您有实例变量指向当前进入的搜索栏
UITextInputMode *inputMode = [self.searchBar textInputMode];
NSString *lang = inputMode.primaryLanguage;