I wanted to disable the emoji keyboard programmatically. please let me know how can i do that ?
I tried using following code,
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithContentsOfFile:@"/private/var/mobile/Library/Preferences/com.apple.Preferences.plist"];
[dict setObject:[NSNumber numberWithBool:NO] forKey:@"KeyboardEmojiEverywhere"];
But no luck ... :(
You can simply set the property keyboardType of the UITextField or UITextView to UIKeyboardTypeASCIICapable. This disables the Emoji Keyboard for this UI element.
This may not work in chinese how ever we have a workaround for it too :
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
if (IS_OS_7_OR_LATER) {
if ([textField isFirstResponder]) {
if ([[[textField textInputMode] primaryLanguage] isEqualToString:@"emoji"] || ![[textField textInputMode] primaryLanguage]) { // In fact, in iOS7, '[[textField textInputMode] primaryLanguage]' is nil
return NO;
}
}
} else {
if ([[[UITextInputMode currentInputMode] primaryLanguage] isEqualToString:@"emoji"] ) {
return NO;
}
}
return YES;
}
User wont be able to type any emoji icon.
Though The Question is super old, I was Facing the same problem and was able to resolve it by the time this page loaded by this small trick :
Simply Select Numbers and Punctuations in Interface Builder Xcode 8.2.1
Output is No Emoji Keyboard =D
I'm sure it'll help Someone =)
The accepted answer works good, however currentInputMode is deprecated in iOS 7. Instead you could use textInputMode as stated in this SO thread:
+(BOOL)isEmojiInput:(UITextView)aTextView
{
return [aTextView textInputMode] == nil;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With