• 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: Shared NSTextView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Shared NSTextView


  • Subject: Re: Shared NSTextView
  • From: chaitanya pandit <email@hidden>
  • Date: Tue, 19 Aug 2008 01:23:33 -0400

You can share an instance of NSTextStorage and NSLayoutManager with multiple NstextContainer+NSTextViews only if you are displaying same text in all those textViews.
But as in your case you will have to use a separate set of above classes for each textView, that means you cannot share the layout manager as it belongs to a single textStorage.
Have a look at the following documentation to get a general idea bout the same
http://developer.apple.com/documentation/Cocoa/Conceptual/TextArchitecture/Concepts/CommonConfigs.html#/ /apple_ref/doc/uid/20000840
-Chaitanya


On 19-Aug-08, at 12:46 AM, Oleg Krupnov wrote:

I am developing a custom view, sort of a simple graphic editor, where
the user can draw graphic boxes of different size. Each box should
display its own attributed string bounded by its own size, and when
the user double-clicks any box, he becomes able to edit the box's text
in-place.

I have read the docs and have a general understanding of the text
system components: NSTextStorage, NSLayoutManager, NSTextContainer and
NSTextView.

However I wonder if some instances of these can be shared across
different graphic boxes for better efficiency?

I could go the simple and dull way and create a separate instance of
NSTextView for each box, but I am afraid this could be a waste of
resources, because layout manager is costy. Also, most of time I only
need to display text in boxes, not to edit it.

I thought it could be smarter to create a single shared instance of
NSTextView per custom view, and re-attach it to different boxes when
the user double-clicks a box. The rest of time I'd use NSTextStorage
and NSTextContainer to just draw the string. Is this a good idea? In
this case, what object instances should each graphic box have of its
own? My guess is that each graphic box should have its own instances
of NSTextStorage and NSTextContainer, but I am not sure what about
NSLayoutManager? Can it be shared too, or it's going to be
inefficient? How do I reconnect the shared components from a box to
another box?

Thanks.
_______________________________________________

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

_______________________________________________

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


  • Follow-Ups:
    • Re: Shared NSTextView
      • From: Graham Cox <email@hidden>
References: 
 >Shared NSTextView (From: "Oleg Krupnov" <email@hidden>)

  • Prev by Date: Re: Shared NSTextView
  • Next by Date: Re: Shared NSTextView
  • Previous by thread: Re: Shared NSTextView
  • Next by thread: Re: Shared NSTextView
  • Index(es):
    • Date
    • Thread