Elliot Alderson
Elliot Alderson

Reputation: 546

I need to disable user interaction with either the keyboard or the entire app

I have a UITextField that brings up the keyboard and right now, once you tap "Go", you can still edit the text field while things are loading (more importantly, you're interacting with the keyboard and can still press the return key again, which creates a bunch of problems).

I've tried [[UIApplication sharedApplication] beginIgnoringInteractionEvents], but you can still interact with the keyboard. I don't want to hide the keyboard while it loads because if the entry is invalid, the user will need to use the keyboard again. Any help is much appreciated.

Upvotes: 0

Views: 728

Answers (2)

Ravi
Ravi

Reputation: 2451

you can try like this,assume goClicked method is fire method when you clicked on "GO"

- (void)goClicked
{
   [self.view endEditing:YES];
   [yourTextField setUserInteractionEnabled:NO];

   //loading things code
   //when loading completes or loading fails
   [yourTextField setUserInteractionEnabled:YES];
}

Upvotes: 0

Robert J. Clegg
Robert J. Clegg

Reputation: 7360

I think you're handling this the wrong way. What I would do is this:

Once the user hits "Go" and the loading starts, hide the keyboard and disable user interaction on the textfield.

If there is an invalid entry, enable the textfield again and bring up the keyboard.

As far as I know, if the keyboard is in view, it cannot be disabled (And for good reason, thats poor UI design. )

Upvotes: 1

Related Questions