You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to iPhone Application Development Auditors
I have the feeling this is going to be extraordinarily simple, but for
some reason the answer is avoiding me...
I'm trying to limit the status UITextField to 140 chars.
I can count to 140, then not allow any further character input just
fine.
However, it'd be handy to allow just backspace/delete to squeak by so
the user can backspace once they have crossed the 140-char limit.
My problem is...how the heck to compare the NSString given me by:
- (BOOL)textField:(UITextField *)textField
shouldChangeCharactersInRange:(NSRange)range replacementString:
(NSString *)string
against the BS (unicode 0x0008) and DEL (unicode 0x007f) keys.
I've tried a number of NSString methods and casts to no avail.
AppleMike
unread,
Nov 13, 2009, 12:41:39 PM11/13/09
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to iPhone Application Development Auditors
Aha...got it figured.
Instead of checking for char '\b' in string, I can just check the
NSRange sent back from
textField:shouldChangeCharactersInRange:replacementString:
If the delete key was pressed, range.length will == 1, otherwise it'll
be 0.