There is a scenario when user enters two character in textfield then focus should move to next textfield.
Below is code that I have used :
func textField(textField: UITextField, shouldChangeCharactersInRange range: NSRange, replacementString string: String) -> Bool {
if let text = textField.text {
let newStr = (text as NSString)
.stringByReplacingCharactersInRange(range, withString: string)
if newStr.isEmpty {
return true
}
let intvalue = Int(newStr)
if textField.tag == 101 { print("101") // only 2 integer
return (intvalue >= 0 && intvalue <= 99) ? true : false
}
else if textField.tag == 102 { print("102") // only 4 integer
return (intvalue >= 0 && intvalue <= 9999) ? true : false
}
}
return true
}
How can this be acheived?
Also, numeric keypad dosen't have Done button?