Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable the emoji keyboard in iOS 7?

Tags:

ios

emoji

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 ... :(

like image 839
Bhat Avatar asked Jul 24 '14 07:07

Bhat


Video Answer


3 Answers

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.

like image 194
Zeeshan Avatar answered Sep 19 '22 08:09

Zeeshan


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

enter image description here

Output is No Emoji Keyboard =D

enter image description here

I'm sure it'll help Someone =)

like image 44
Yash Bedi Avatar answered Sep 22 '22 08:09

Yash Bedi


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;
}
like image 28
hris.to Avatar answered Sep 19 '22 08:09

hris.to