Pressing between UITextFields in iOS7

When the UITextFieldkeyboard is selected and displayed, if I touch other parts of the view, the keyboard disappears.

If I touch another UITextField, the keyboard will remain, the first text box will be canceled, and nothing will happen. Then I need to press another one again UITextFieldto select, and the keyboard will appear.

Is there a way to make the second UITextField available immediately when the first is selected UITextField?

+3
source share
4 answers

If you reload the table in textFieldDidEndEditing, you break the selection in this way. Do not do this.

+1
source

try, click another view to call below fn.

-(void)disappearKey{
[self.view endEditing:YES];
}

, , .

+1

, , , UITextField UITextView. , Apple .

, , , . , , , [textField resignFirstResponder];

:

UIKeyboardWillShowNotification
UIKeyboardDidShowNotification
UIKeyboardWillHideNotification
UIKeyboardDidHideNotification

, UITextfield textview

 – textFieldShouldBeginEditing: 
 – textFieldDidBeginEditing:
 – textFieldShouldEndEditing:
 – textFieldDidEndEditing:

At the moment, I am not an active project, so I'm not sure that I just ignored the problem, but I can’t remember how this happens to me.

0
source
  • you can use BSKeyboardControls . just view the demo and decide whether to use it or not.

  • or you can set the tag sequentially in each text field
    in uiview. then use the code below.

    -(BOOL)textFieldShouldReturn:(UITextField*)textField
    
    {
         NSInteger nextTag = textField.tag + 1;
    
         UIResponder* nextResponder = [textField.superview viewWithTag:nextTag];
    
         if (nextResponder) {
    
        [nextResponder becomeFirstResponder];
    
        } else {
    
        [textField resignFirstResponder];
     }
    return NO; 
    }
    
0
source

All Articles