• 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: location of text in NSTextView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: location of text in NSTextView


  • Subject: Re: location of text in NSTextView
  • From: Douglas Davidson <email@hidden>
  • Date: Mon, 23 Jan 2006 12:58:53 -0800


On Jan 23, 2006, at 12:53 PM, Nik Youdale wrote:

range = [[textView layoutManager] glyphRangeForCharacterRange:someRange actualCharacterRange:nil];
rect = [[textView layoutManager] boundingRectForGlyphRange:range inTextContainer:[textView textContainer]];
rect2 = [self convertRect:rect fromView:textView];
return rect2;



This isn't correct in general. The layout manager works in text container coordinates, which are offset from text view coordinates by the text view's textContainerOrigin. In many cases the textContainerOrigin will be {0, 0}, but you should not rely on this in general. The sample code should demonstrate this conversion process.


Douglas Davidson

_______________________________________________
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: 
 >location of text in NSTextView (From: Nik Youdale <email@hidden>)
 >Re: location of text in NSTextView (From: Eamon Ford <email@hidden>)
 >Re: location of text in NSTextView (From: Nik Youdale <email@hidden>)
 >Re: location of text in NSTextView (From: Douglas Davidson <email@hidden>)
 >Re: location of text in NSTextView (From: Nik Youdale <email@hidden>)

  • Prev by Date: Re: location of text in NSTextView
  • Next by Date: Re: Database frameworks for Cocoa
  • Previous by thread: Re: location of text in NSTextView
  • Next by thread: Re: location of text in NSTextView
  • Index(es):
    • Date
    • Thread