Search code examples
iphoneuiresponderiphone-softkeyboard

iPhone - temporarily disable keyboard


G'day All

My app has a first run component that presents a login/signup screen & on successful login/signup moves on to loading the app's data. For those who've seen it the process follows similar style to that in Instagram. If the keyboard is dismissed on entering the password & there's an error it pops back up as soon as it's gone which strikes me as not being a great look. So is there any way to disable the keyboard or prevent user interaction without actually dismissing it while the app sends the user credentials & waits for a response?

Cheers & TIA, Pedro :)


Solution

  • After the first dismiss, I would set the UITextField as disabled. No user Interaction is possible anymore and the keyboard shouldn't pop up anymore. This will also have the nice UI touch of being greyed out.

    Additionally, you should have a TextFieldDelegate 1 implement textFieldShouldBeginEditing: and return NO;. That will cause the keyboard to not appear.