Uialertview's Textfield Does Not Show Keyboard in iOS8

UIAlertView's textfield does not show keyboard in iOS8

This ugly hack worked for me, after calling show:

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// HACKHACK: This is to make the keyboard appear in iOS8
UITextRange* textRange = self.textField.selectedTextRange;
[self.textField selectAll:self];
[UIMenuController sharedMenuController].menuVisible = NO;
self.textField.selectedTextRange = textRange;
});

Ran into the same problem, and spent hours fiddling with UIAlertController, which is the "right" solution, but unfortunately has several issues elsewhere (e.g. it breaks when presenting from a popover), and won't work with iOS7.

This is definitely a bug in iOS8. I hope Apple fixes this soon. It unfortunately breaks even with older binaries compiled for iOS7.

UIAlertView Vs UIAlertController - no keyboard in iOS 8

I Tested this, if iOS8 detects a hardware keyboard , than it does not open the keypad. As you might be testing in simulator , so it is not Showing any keypad

Press "Command" + "k" and you should be able to see the keypad.

When testing on a device you will not face this issue , unless user has connected his device with a hardware Bluetooth keypad , so this is not something you should worry about

Hope this helps

UIAlertView displaying keyboard, not able to dismiss it

I borrow solution from this blog

For me the keyboard always show up when the alertView.show() has been called.

My solution is using the didPresentALertView method for make sure this will called after the alert view popup. Then we can loop through all UIWindows and it's subviews. I detect it by description name (You can use more accurate method if you want) and just simply remove it from superview.

func didPresentAlertView(alertView: UIAlertView) {
var tempWindow: UIWindow;
var keyboard: UIView;

for var c = 0; c < UIApplication.sharedApplication().windows.count; c++ {
tempWindow = UIApplication.sharedApplication().windows[c] as! UIWindow
for var i = 0; i < tempWindow.subviews.count; i++ {
keyboard = tempWindow.subviews[i] as! UIView

println(keyboard.description)

if keyboard.description.hasPrefix("<UIInputSetContainerView") {
keyboard.removeFromSuperview()
}
}
}
}

Hope this thelp.

Keyboard will appeared automatically in ios 8.3 while displaying alertview or alertcontroller

Yep, it's strange.

But since iOS 8, I suggest to use the UIAlertController instead of UIAlertView.

Replace your code with this one:

- (IBAction)MethodShowAlert:(id)sender
{

[tmptxtField resignFirstResponder];

UIAlertController * alertController = [UIAlertController alertControllerWithTitle:@"Check Alert textField"
message:@"keyboard should not be open"
preferredStyle:UIAlertControllerStyleAlert];

UIAlertAction * cancelAction = [UIAlertAction actionWithTitle:@"Cancel"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) {
[self showCustomAlertWithTitle:@"Now Check"];
}];

[alertController addAction:cancelAction];

[self presentViewController:alertController animated:YES completion:nil];
}

-(void)showCustomAlertWithTitle:(NSString *)title{

UIAlertController * alertController = [UIAlertController alertControllerWithTitle:title
message:nil
preferredStyle:UIAlertControllerStyleAlert];

[self presentViewController:alertController animated:YES completion:nil];
}

The keyboard will not show after the click on the button.

How to show keyboard when entering key in searchbar in ios8

It looks like you're using the simulator. In the iOS 8 simulator, the soft keyboard is hidden by default if you allow the simulator to access the mac's keyboard. You can toggle the appearance of the soft keyboard with Cmd + Shift + K. The relevant settings are in the Hardware menu.



Related Topics



Leave a reply



Submit