Re: UITextView symbols
Re: UITextView symbols
- Subject: Re: UITextView symbols
- From: DKJ <email@hidden>
- Date: Sat, 27 Jun 2009 19:13:34 -0700
On 27-Jun-09, at 16:26 , DKJ wrote:
I'm using this method:
textView:shouldChangeTextInRange:replacementText:
to let users put special symbols into a UITextView.
I detect the Return key by checking whether the input string is
equal to @"\n". But how would I detect the back-delete key? @"\b"
doesn't do it. And I can't seem to find any docs that list these
codes.
I wanted to let the back-delete key do what it normally does, while at
the same time stopping other keys like '1', '&', etc. from being
processed. (i.e. The method returns 'NO' when those keys are pressed.)
I found (more or less by accident) that this will do the trick:
if( [text length] == 0 )
return YES;
where 'text' is the replacementText: parameter of the method.
I don't know why it works, but that's not important right now.
Thanks to anyone who's been thinking about this.
dkj
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden