• 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: text system architecture
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: text system architecture


  • Subject: Re: text system architecture
  • From: Douglas Davidson <email@hidden>
  • Date: Mon, 14 Jul 2003 14:34:27 -0700

On Monday, July 14, 2003, at 02:06 PM, johness does wrote:

First question:

I'm making to text views that show the exact same
thing. I currently have them sharing a text storage
object. Should/can they share any other text system
architecture object (i.e. NSLayoutManager,
TextContainer, etc.) safely? Or is this automatically
done when I use the replaceTextStoreage: message?

The view system is such that a single view cannot appear in more than one place in the view hierarchy, so you will probably need two distinct NSTextViews. Each NSTextView should have its own NSTextContainer--potentially view can affect container and vice versa, so each needs its own. If an NSLayoutManager has more than one text container, it lays text out into them sequentially one after the other, which is not what you are after. So you are doing the right thing by having them share a text storage and each have their own layout manager, text container, and text view. Note that views typically can resize under one set of circumstances or another, and this often causes text to need to be relaid, so it is appropriate in general for each of these views to have a separate layout manager, even if in your particular case you are arranging things so the two views always are exactly the same size.

Second question:

Using NSLayoutManager I am able to figure out how high
line fragments are etc., but is there any way for me
to QUICKLY figure out what line number a certain point
is at, given I am not using word wrap?

Take a look at the LayoutManagerDemo on developer.apple.com. This demonstrates using NSLayoutManager API to locate the glyph nearest a particular point, and then to determine whether that point is actually over that glyph or not.

Douglas Davidson
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >text system architecture (From: johness does <email@hidden>)

  • Prev by Date: Objective-C and Java
  • Next by Date: Re: Interface Builder format -- .xib vs. .nib
  • Previous by thread: text system architecture
  • Next by thread: Objective-C and Java
  • Index(es):
    • Date
    • Thread