Reputation: 2272
When setting the keyboard in IB or programatically as below for a UITextField.
[textFieldOutlet setKeyboardType:UIKeyboardTypeEmailAddress];
The keyboard has an Emoji icon which means you can type in Emoji's in an email address (which is a bit rubbish). Can this be disabled? I understand I can change the type to ASCIICapable but then I do not have the easy access to @ and . signs.
I have worked around it with this which just stops the Emoji being entered but the button is still there (Credit Here with MeganZhou answer).
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
if ([textField isFirstResponder])
{
if ([[[textField textInputMode] primaryLanguage] isEqualToString:@"emoji"] || ![[textField textInputMode] primaryLanguage])
{
return NO;
}
}
return YES;
}
I have also noted that the icon is there when you are typing an email address in Mail too.
This is iOS8 but may also be in earlier version.
Upvotes: 10
Views: 4806
Reputation: 8506
User have to follow below steps if he wants to get rid of emoji button.
This will remove the emoji button and user can also have easy access to @ and . signs.
Note
:- For security reasons, iOS does not allow programmers to remove keyboard programatically.
Upvotes: 5