I know how to put character length limit on UITextField. But I am looking for an idea how to put amount limit on UITextField so that it can not take more than that limited amount.
I want to put limit on TextField that can accept value in between 0 to 1000000
I tried to get it using UITextFieldDelegate's method
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
if let amount = Int(textField.text!) ,amount>1000000{
return false
}else{
return true
}
}
but I am not able to achieve the result.