Created
April 28, 2020 12:15
-
-
Save fatihyildizhan/ac5f476aebd306b0580a1fa069f153a3 to your computer and use it in GitHub Desktop.
Force to lower or uppercase on Swift
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 { | |
if textField.isEqual(textFieldBodrum) { | |
textFieldBodrum.text = (textField.text as NSString).stringByReplacingCharactersInRange(range, withString: string.lowercaseString) | |
return false | |
} else if textField.isEqual(textFieldYalikavak) { | |
textFieldYalikavak.text = (textField.text as NSString).stringByReplacingCharactersInRange(range, withString: string.uppercaseString) | |
return false | |
} | |
return true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment