I have a UITextfield for entering text. A button triggers a functionality. After completion of the IBAction the UITextfield is getting focused again. After the IBAction I want to keyboard to disappear. What happends now is that due to the IBAction of the button, the keyboards disappears (I'm showing a UIAlert) and after the IBAction the keyboards pop's up a开发者_如何学Cgain together with the focus in the UITextfield. Is it possible to prevent the UITextfield to be focused after the IBAction?
Before displaying the alert, call [resignFirstResponder] on the UITextField.
Found the problem. While carrying out the operations in the IBAction method I was locking the view with:
[self.view setUserInteractionEnabled:NO];
// do the job
[self.view setUserInteractionEnabled:YES];
This activates the UITextfield again. So I put a [self.hostName resignFirstResponder]; directly behind the setUserInteractionEnabled:YES.
So after coming back from the IBAction nothing is focused.
SOLUTION:
[self.view setUserInteractionEnabled:NO];
// do the job
[self.view setUserInteractionEnabled:YES];
[self.hostName resignFirstResponder];
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论