Reputation: 602
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 ... :(
Upvotes: 6
Views: 8945
Reputation: 1355
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 =)
Upvotes: 2
Reputation: 6363
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;
}
Upvotes: 1
Reputation: 4244
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.
Upvotes: 7