I have six textfields
. Now if all my textfield
are filled and tap on any textfield
the it should always put focus on sixth textfield
& show the keyboard. I have tried below code but it does not show keyboard
and only put focus when I tap on sixth textfield
. please tell me what is the issue with this ?
func textFieldDidBeginEditing(_ textField: UITextField) {
textField.inputAccessoryView = emptyView
if let textOneLength = textFieldOne.text?.length ,let textTwoLength = textFieldTwo.text?.length ,let textThreeLength = textFieldThree.text?.length , let textFourLength = textFieldFour.text?.length,let textFiveLength = textFieldFive.text?.length , let textSixLength = textFieldSix.text?.length {
if (textOneLength > 0) && (textTwoLength > 0) && (textThreeLength > 0) && (textFourLength > 0) && (textFiveLength > 0) && (textSixLength > 0) {
self.textFieldSix.becomeFirstResponder()
} else if (textOneLength <= 0) && (textTwoLength <= 0) && (textThreeLength <= 0) && (textFourLength <= 0) && (textFiveLength <= 0) && (textSixLength <= 0){
self.textFieldOne.becomeFirstResponder()
}
}
}