1

I have an animation, during which I want to disable the keyboard but not hide it. I even tried self.view.userInteractionEnabled = NO;, but that hides the keyboard. I guess it must call resignFirstResponder.

ma11hew28
  • 121,420
  • 116
  • 450
  • 651

2 Answers2

1

To disable everything, you can use

[[UIApplication sharedApplication] beginIgnoringInteractionEvents];

right before you start the animation and

[[UIApplication sharedApplication] endIgnoringInteractionEvents];

after the animation finishes, e.g., in its completion block.

ma11hew28
  • 121,420
  • 116
  • 450
  • 651
0

You can disable the keyboard without dismissing it by doing:

NSArray *windows = [UIApplication sharedApplication].windows;
if ([windows count] > 1) {
    UIWindow *keyboardWindow = windows[1];
    keyboardWindow.userInteractionEnabled = NO;
}

But, it's obviously very hackish & fragile, and I'm not sure if it complies with Apple's terms.

ma11hew28
  • 121,420
  • 116
  • 450
  • 651