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

Re: Copying NSTextStorage


  • Subject: Re: Copying NSTextStorage
  • From: Gordon Apple <email@hidden>
  • Date: Fri, 30 May 2008 10:13:35 -0500

    Yes, I did try mutable copy (which still required intercepting the
"text" key when copying the shape).  It didn't help.

    I inserted some test code to try to figure out why it was crashing my
program.  The NSTextStorage, when copied, would blow up when asking for
layoutManagers.  (I was trying to see if it had one by default.)  So
something is not getting initialized in the copy.

    Why NSTextStorage?  Because that is what Sketch uses, and I lifted as
much code from there as I could, although I use my own Bezier text container
when rendering it.  The floating NSTextView uses it directly.  I suppose I
could change it to store NSMutableAttributedString and create the
NSTextStorage on-the-fly when rendering (and for the floating edit view).

    Anyway, like I said, creating a new NSTextStorage, initialized with the
old storage, seems to have solved that problem, although I don't understand
why the problem just surfaced now.

>
> On 29 May '08, at 11:03 AM, Gordon Apple wrote:
>
>>    Apparently, NSTextStorage does not conform to NSCopying, even
>> though its
>> superclass (NSAttributedString) does.  Has something changed
>> recently with
>> NSTextStorage that makes "copy" not work?
>
> Is there a reason you need to use NSTextStorage instead of
> NSAttributedString? Generally the only place NSTextStorage is used is
> in the innards of NSTextViews.
>
> I'm not sure what -copy would do with an NSTextStorage, since it
> inherits from NSMutableAttributedString, and copying an
> NSMutableAttributedString returns an NSAttributedString. In other
> words, copying mutable objects returns immutable ones. Have you tried
> using -mutableCopy instead?
>
> ‹Jens

_______________________________________________

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: Copying NSTextStorage
      • From: "Kyle Sluder" <email@hidden>
References: 
 >Re: Copying NSTextStorage (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: NSURLConnection sendSynchronousRequest crash
  • Next by Date: Re: NSTextView and changing the selected text's color
  • Previous by thread: Re: Copying NSTextStorage
  • Next by thread: Re: Copying NSTextStorage
  • Index(es):
    • Date
    • Thread