How to detect UIKeyboard “backspace” button touch on UITextField? [duplicate]

if the UITextField is empty, the shouldChangeTextInRange delegate method is not called You can subclass UITextField and override this method: -(void)deleteBackward; { [super deleteBackward]; NSLog(@”BackSpace Detected”); } since UITextField is compliant to the UITextInput protocol, this method is implemented, and you can override it to detect when backspace is pressed. Then, you can write your … Read more

iOS 8 keyboard hides my textview

@Oleg’s solution is good but it doesn’t take into consideration keyboard changes in size while its already showing.. also, he hardcoded the animation duration and a few other parameters. See my solution below: Add an observer of UIKeyboardWillChangeFrameNotification to the viewDidLoad [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardFrameWillChange:) name:UIKeyboardWillChangeFrameNotification object:nil]; And then add the method: – (void)keyboardFrameWillChange:(NSNotification *)notification … Read more

UIKeyboardBoundsUserInfoKey is deprecated, what to use instead?

I played with the previously offered solution but still had issues. Here’s what I came up with instead: – (void)keyboardWillShow:(NSNotification *)aNotification { [self moveTextViewForKeyboard:aNotification up:YES]; } – (void)keyboardWillHide:(NSNotification *)aNotification { [self moveTextViewForKeyboard:aNotification up:NO]; } – (void) moveTextViewForKeyboard:(NSNotification*)aNotification up: (BOOL) up{ NSDictionary* userInfo = [aNotification userInfo]; // Get animation info from userInfo NSTimeInterval animationDuration; UIViewAnimationCurve animationCurve; … Read more

UITextView cursor below frame when changing frame

Instead of resizing the frame, why not give your text view a contentInset (and a matching scrollIndicatorInsets)? Remember that text views are actually scrollviews. This is the correct way to handle keyboard (or other) interference. For more information on contentInset, see this question. This seems to not be enough. Still use insets, as this is … Read more

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.

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