Autolayout Constraint – Keyboard

Try it this way: self.keyboardHeight.constant = -height; [self.view setNeedsUpdateConstraints]; [UIView animateWithDuration:animationDuration animations:^{ [self.view layoutIfNeeded]; }]; Remember this pattern because this should be the correct way to update constraint-based layouts (according to WWDC). You can also add or remove NSLayoutConstraints as long as you call setNeedsUpdateConstraints after.

Leaving inputAccessoryView visible after keyboard is dismissed

It’s done like this: Assign your UIToolbar to a property in your view controller: @property (strong, nonatomic) UIToolbar *inputAccessoryToolbar; In your top view controller, add these methods: – (BOOL)canBecomeFirstResponder{ return YES; } – (UIView *)inputAccessoryView{ return self.inputAccessoryToolbar; } And then (optionally, as it usually shouldn’t be necessary), whenever the keyboard gets hidden, just call: [self … Read more

iOS – How can I preload the keyboard?

UIResponder+KeyboardCache was written to address this exact problem. From that project’s readme: This category on UIResponder gives you a simple method +cacheKeyboard so that you can control when this caching work is done. For example, if you are loading some data from a server, then you could invoke this during that downtime. There is another … Read more

in iOS8 using .focus() will show virtual keyboard and scroll page after touch

It looks like you’re definitely hitting an iOS 8 bug. In iOS7, Safari would (apparently) ignore or keep unfocused elements that had focus set prior to page load. This includes both <input autofocus> and input.focus() that occur up to some point, possibly page load (I tested just with an inline script). In iOS 8, Safari … Read more

How to add done button on keyboard on top of keyboard in IOS?

Hope this help 🙂 UIToolbar* keyboardToolbar = [[UIToolbar alloc] init]; [keyboardToolbar sizeToFit]; UIBarButtonItem *flexBarButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]; UIBarButtonItem *doneBarButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(yourTextViewDoneButtonPressed)]; keyboardToolbar.items = @[flexBarButton, doneBarButton]; self.yourTextView.inputAccessoryView = keyboardToolbar; and then add yourTextViewDoneButtonPressed method -(void)yourTextViewDoneButtonPressed { [self.yourTextView resignFirstResponder]; }

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

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.

tech