Change the iOS Keyboard Layout to Emoji

Show Emoji keyboard programatically in iOS 9.0

it seems that you cannot do this, iOS does not provide any public api to programatically switch to another input method, and emoji keyboard is regarded as a kind of input method.

Showing the system Emoji keyboard by default on iOS 13


NB: Make sure you have the Emoji keyboard enabled.

This seems to be an iOS 13 bug, the work around (for devices, this does not affect the Simulator) is to override the textInputContextIdentifier property and return a non-nil value.

//
// ViewController.swift
// Keyboard Info
//
// Created by Richard Stelling on 30/09/2019.
// Copyright © 2019 Richard Stelling. All rights reserved.
//

import UIKit

class TestButton: UIButton, UIKeyInput {

var hasText: Bool = true

override var textInputContextIdentifier: String? { "" } // return non-nil to show the Emoji keyboard ¯\_(ツ)_/¯

func insertText(_ text: String) { print("\(text)") }

func deleteBackward() {}

override var canBecomeFirstResponder: Bool { return true }

override var canResignFirstResponder: Bool { return true }

override var textInputMode: UITextInputMode? {
for mode in UITextInputMode.activeInputModes {
if mode.primaryLanguage == "emoji" {
return mode
}
}
return nil
}
}

Thanks to blld for his answer.

Offset UITextField - Emoji-layout

Thanks guys for your help, i have found the answer:
I was using this line :

if let keyboardSize = (notifcation.userInfo?[UIKeyboardFrameBeginUserInfoKey] as? NSValue)?.CGRectValue().size{

I changed to the key-value of notifcation.userInfo to UIKeyboardFrameEndUserInfoKey, and that fixed the issue.

Call emoji keyboard programmatically?

Unfortunately this can't be done in iOS yet. Apple does not provide any public API to programatically switch to another input method. This is something the user has to change.

How to call emoji keyboard programmatically for textview

Emoji is also considered a language keyboard, As of now Apple does not provide any public API to programmatically switch to another input method.

However there may be a workaround, This question might help:
Change the iOS keyboard layout to emoji?



Related Topics



Leave a reply



Submit