Change the iOS keyboard layout to emoji?

Create a subclass of UITextField like this: class EmojiTextField: UITextField { // required for iOS 13 override var textInputContextIdentifier: String? { “” } // return non-nil to show the Emoji keyboard ¯\_(ツ)_/¯ override var textInputMode: UITextInputMode? { for mode in UITextInputMode.activeInputModes { if mode.primaryLanguage == “emoji” { return mode } } return nil } } … Read more

Change text of “Return” keyboard button

Unfortunately, you can change “Return” into only one of these predefined labels with the returnKeyType property: Return (default) Go Google Join Next Route Search Send Yahoo Done Emergency Call Continue (as of iOS 9) So maybe you should choose “Next” if a data entry kind of activity is what you’re after. More information here.

Programmatically change UITextField Keyboard type

There is a keyboardType property for a UITextField: typedef enum { UIKeyboardTypeDefault, // Default type for the current input method. UIKeyboardTypeASCIICapable, // Displays a keyboard which can enter ASCII characters, non-ASCII keyboards remain active UIKeyboardTypeNumbersAndPunctuation, // Numbers and assorted punctuation. UIKeyboardTypeURL, // A type optimized for URL entry (shows . / .com prominently). UIKeyboardTypeNumberPad, // … Read more

Getting keyboard size from userInfo in Swift

There are some problems in your line: var keyboardSize = notification.userInfo(valueForKey(UIKeyboardFrameBeginUserInfoKey)) notification.userInfo returns an optional dictionary [NSObject : AnyObject]?, so it must be unwrapped before accessing its values. The Objective-C NSDictionary is mapped to a Swift native Dictionary, so you must use the dictionary subscript syntax (dict[key]) to access the values. The value must be … Read more

How to get height of Keyboard?

Swift You can get the keyboard height by subscribing to the UIKeyboardWillShowNotification notification. (Assuming you want to know what the height will be before it’s shown). Swift 4 NotificationCenter.default.addObserver( self, selector: #selector(keyboardWillShow), name: UIResponder.keyboardWillShowNotification, object: nil ) @objc func keyboardWillShow(_ notification: Notification) { if let keyboardFrame: NSValue = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue { let keyboardRectangle = … Read more

Close iOS Keyboard by touching anywhere using Swift

override func viewDidLoad() { super.viewDidLoad() //Looks for single or multiple taps. let tap = UITapGestureRecognizer(target: self, action: #selector(UIInputViewController.dismissKeyboard)) //Uncomment the line below if you want the tap not not interfere and cancel other interactions. //tap.cancelsTouchesInView = false view.addGestureRecognizer(tap) } //Calls this function when the tap is recognized. @objc func dismissKeyboard() { //Causes the view (or … Read more

Dismiss keyboard by touching background of UITableView

This is easily done by creating a UITapGestureRecognizer object (by default this will detect a “gesture” on a single tap so no further customization is required), specifying a target/action for when the gesture is fired, and then attaching the gesture recognizer object to your table view. E.g. Perhaps in your viewDidLoad method: UITapGestureRecognizer *gestureRecognizer = … Read more

Move view with keyboard using Swift

Here is a solution, without handling the switch from one textField to another: override func viewDidLoad() { super.viewDidLoad() NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector(“keyboardWillShow:”), name: UIKeyboardWillShowNotification, object: nil) NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector(“keyboardWillHide:”), name: UIKeyboardWillHideNotification, object: nil) } func keyboardWillShow(notification: NSNotification) { if let keyboardSize = (notification.userInfo?[UIKeyboardFrameEndUserInfoKey] as? NSValue)?.CGRectValue() { self.view.frame.origin.y -= keyboardSize.height } } func keyboardWillHide(notification: NSNotification) { self.view.frame.origin.y … Read more

tech