func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool
{
if let text = textField.text {
if text == "" && string == "0"
{
return false
}
let newLength = text.characters.count + string.characters.count - range.length
return newLength <= 4 // Bool
}
else
{
return false
}
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.