Created
March 6, 2015 23:45
-
-
Save dbettermann/88d0e7e5264bb0640056 to your computer and use it in GitHub Desktop.
Only allow numbers and backspaces in UITextField
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func textField(textField: UITextField, shouldChangeCharactersInRange range: NSRange, replacementString string: String) -> Bool { | |
return string.toInt() != nil || string.isEmpty | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment