How can I set the max string length for a textfield created within a UIAlertView? I am using Xcode 4.5 and building the app on 10.8 (OS X) Currently I have UIAlertView that launches when the user clicks a button. The user will scan their RFID badge, and I want the input textfield of the UIAlertView to be limited to 10 (ten) characters so the user can’t fudge association process.
How can I set the max string length for a textfield created within a
Share
Looks like the above answer is almost right.
When typing single characters, range.length (for this method) appears to always be zero, while the location increments.
edit: length would probably be longer if you doing something other than single-character typing, i.e. pasting a line, etc.