Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 5: How can I disable Emoji keyboard in my application?

I don't want the Emoji keyboard allowance in my application so I want to disable it only in my application. There is one way to do it by applying the answer from this link:

Making An Emoji Enabeling App

But this would not work on iOS 5 (iOS 4.3 do work). Is there any way to disable Emoji keyboard in iOS 5. Thank you.

like image 465
Protocole Avatar asked Dec 29 '11 04:12

Protocole


People also ask

Can you disable Emoji keyboard?

Start typing and once you see the emoji bar, swipe left on it. You will see a Remove Bar button, tap on it and it will take you to settings. Here you can disable the Emoji fast-access bar toggle to disable that emoji bar completely.

How to disable emoji on iPhone or iPad?

Disable Emoji on iPhone 1 Open the "Settings" app on iPhone or iPad. 2 Go to "General" and then to "Keyboard". 3 Choose "Keyboard". 4 Tap the "Edit" button in the corner of Keyboard settings. 5 Now tap the (-) red minus button next to "Emoji". 6 Tap on the "Delete" button next to Emoji. 7 Tap "Done" or exit Settings. See More....

How do I remove the emoji button from my keyboard?

You can remove the emoji button from your on-screen keyboard. Here’s how. First, launch “Settings” by tapping on the “Gear” icon. (It’s usually in your Dock or on the first page of your Home screen.) In Settings, scroll down and tap “General.” Next, tap “Keyboard.” On the next screen after that, tap “Keyboards” at the top.

How can I edit the Apple emoji keyboard on iOS8?

Unfortunately, there is no way to edit the Apple Emoji keyboard. You can, however, turn it off, by following the instructions posted at the following question: How can I remove Emoji keyboard from iOS8? Settings → General → Keyboard → Keyboards. You'll see English and Emoji. On the top right corner is the word Edit.

How do you put emojis on your phone?

You can do emoji on any phone. Just download it in settings and go to a keyboard on your phone, and then click the smiley face on the bottom, near the space bar.


2 Answers

You can simply set the property keyboardType of the UITextField or UITextView to UIKeyboardTypeASCIICapable. This disables the Emoji Keyboard for this UI element.

like image 142
mschluepmann Avatar answered Oct 25 '22 05:10

mschluepmann


@mschluepmann, But set UIKeyboardTypeASCIICapable can not input Chinese

And you can do it like below

- (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;
}

But sometimes, the emoji may not entered by emoji keyboard. For example, when you type "哈哈" it shows 😄 emoji on the header of the keyboard. In the case, the code above will make no effect. So you should do a twice validation as following:

- (BOOL)isValidString
{
    NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"[^\\u0020-\\u007E\\u00A0-\\u00BE\\u2E80-\\uA4CF\\uF900-\\uFAFF\\uFE30-\\uFE4F\\uFF00-\\uFFEF\\u0080-\\u009F\\u2000-\\u201f\r\n]" options:NSRegularExpressionCaseInsensitive error:nil];

    NSUInteger numberOfMatches = [regex numberOfMatchesInString:self options:NSMatchingWithTransparentBounds range:NSMakeRange(0, [self length])];

    if (numberOfMatches > 0) {
        return NO;
    }

    return YES;
}
like image 24
MeganZhou Avatar answered Oct 25 '22 05:10

MeganZhou