• 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: Does characterIndexForPoint ever return NSNotFound?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Does characterIndexForPoint ever return NSNotFound?


  • Subject: Re: Does characterIndexForPoint ever return NSNotFound?
  • From: Camillo Lugaresi <email@hidden>
  • Date: Tue, 24 Jan 2006 14:28:46 +0100

On 23/gen/06, at 23:44, Douglas Davidson wrote:


On Jan 20, 2006, at 7:42 AM, Camillo Lugaresi wrote:

According to the documentation, characterIndexForPoint returns NSNotFound for points which are not over any character. However, in practice it always seems to return a valid character index: for example, for points way above the upper edge of the screen it returns 0, and for points way below it returns the index of the last character. Can anyone confirm this? Should I file a bug?


First, if you aren't working with input methods, I would suggest not using characterIndexForPoint:--it's intended for input method use. See the LayoutManagerDemo sample code on developer.apple.com for recommended means of dealing with point-to-character conversions. Second, in this case the header comments are more accurate.

Thank you for the sample code. I will replace the existing usage of characterIndexForPoint:; the recommended method looks pretty straightforward.
I would really appreciate your advice on a more complex question; please read the message "Optimizing text layout in a log view: should I subclass NSLayoutManager?" if you have time.


Thanks,
Camillo
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Does characterIndexForPoint ever return NSNotFound? (From: Camillo Lugaresi <email@hidden>)
 >Re: Does characterIndexForPoint ever return NSNotFound? (From: Douglas Davidson <email@hidden>)

  • Prev by Date: NS .... lex/yacc ?
  • Next by Date: Re: Can bindings be set to ignore certain values?
  • Previous by thread: Re: Does characterIndexForPoint ever return NSNotFound?
  • Next by thread: Launching an application from cocoa
  • Index(es):
    • Date
    • Thread