Reputation: 21
I have an UITextField named "TextField" and I want to get only one letter form A to Z. User will not enter more than 1 letter on this TextField. How can I do this?
Upvotes: 0
Views: 601
Reputation: 4040
In order to control user input into a UITextField
, you must implement the UITextFieldDelegate
protocol in your controller.
UITextFieldDelegate Documentation
In particular, look into textField(_:shouldChangeCharactersInRange:replacementString:)
and return a Bool
value that allows the character or not.
Upvotes: 2