Limit number of characters in UITextField where input is from UI
<p>I have a UITextField for which I get input from some buttons that are part of the UI (so the input does not come form the phone's virtual keyboard). I want to limit that number of characters. I tried using the <code>shouldChangeCharactersInRange</code>, but it only works if the input comes form the virtual keyboard, and it doesn't work if the input comes from the buttons on the UI. Is there anyway I can solve this without programmatically having to count the characters in the text field every time I want to update it?</p>

<p>Thank you,
Mihai Fonoage </p>
