• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: UITextView symbols
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >UITextView symbols (From: DKJ <email@hidden>)

  • Prev by Date: Re: Base SDK and deployment target Q
  • Next by Date: Re: Serial device open(2) hang.
  • Previous by thread: UITextView symbols
  • Next by thread: Re: UITextView symbols
  • Index(es):
    • Date
    • Thread