John Lane
John Lane

Reputation: 1132

UIAlertView shown in NSOperation - view controller unresponsive

I have an NSOperation subclass that does some heavy calculations. It has a delegate as well.

If the user does not provide correct input, I validate it in the main method and through performSelectorOnMainThreadI create and show an alert (from my NSOperation subclass) and then I call the delegate method as such:

    -(void) main{
    [self performSelectorOnMainThread:@selector(showAnAlert)
                                       withObject:nil
                                    waitUntilDone:YES];
                [self cancel]; //I need to cancel the operation
                return; //don't want to finish main running.

    }

- (void) showAnAlert{
   //Create an alert here
   [alert show];
}

And in my VC I have this: 

- (void) aDelegateMethodFromMyOperation{
   [self.textField setEndEditing:YES];
}

Now the problem is, once I dismiss the alert, I can't input any text in my textField.... It will show the keyboard on tap... but it won't accept my input... why is that?

Upvotes: 0

Views: 310

Answers (1)

The Kraken
The Kraken

Reputation: 3158

Perhaps try:

[textField becomeFirstResponder];

Because you're switching through multiple UI elements in the NSOperation, it is possible that full control is not being regained by the text field.

Upvotes: 1

Related Questions