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
How to Display Activity Indicator in Center of Uialertcontroller
Lazy Loading Data in iOS Carplay
Uiimagejpegrepresentation Returns Nil
Swift - Clipping Image with Uibezierpath
Sprite Moves Two Places After Being Paused and Then Unpaused
Route Not Showing in Mkmapview
How to Prevent Duplicate Entry on Parse
How to Present iOS Uiactionsheet in Swift
Swift - Check If a Timestamp Is Yesterday, Today, Tomorrow, or X Days Ago
iOS 9 Safari: Changing an Element to Fixed Position While Scrolling Won't Paint Until Scroll Stops
App Killed by Sigkill When Changing Privacy Settings
How to Detect When Avplayer Video Ends Playing
Immutable/Mutable Collections in Swift
Custom Uitableviewcell Selection Style
Load Local HTML into Uiwebview Using Swift
Uialertview/Uialertcontroller iOS 7 and iOS 8 Compatibility
Prevent Deploying (Disable) Watchkit App with iOS iPhone App in Xcode