UITextField toggles the next input box after clicking a newline

// In the input phone number text box, the keyboard return key becomes the  next  key in the next line   
self .numberTextFiewld .returnKeyType  = UIReturnKeyNext;
 
//Set the type of the textbox
self . shouJiHao . keyboardType = UIKeyboardTypeNumberPad ;
 
//Proxy method   keyboard recovery
-(BOOL)textFieldShouldReturn:(UITextField *)textField{
    if (textField  == self.numberTextFiewld) { 

      // Click on the newline to   make the next textField the focus, that is, the passwordTextField becomes the focus

        [self.passwordTextField becomeFirstResponder];

        return YES;

          }

 

}
 
- ( BOOL )textFieldShouldReturn:( UITextField *)textField {
   
if (textField == self . xingMing ) {
        [
self . shouJiHao becomeFirstResponder ];
    }
else if (textField == self . shouJiHao ) {
        [
self . shouHuoAdress becomeFirstResponder ];
    }
else if (textField == self . shouHuoAdress ) {
        [
self . menPaiHao becomeFirstResponder ];
    }
else {
        [textField
resignFirstResponder ];
    }

   
return YES ;
}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326262019&siteId=291194637