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

NSTextStorage and NSTextAttachment


  • Subject: NSTextStorage and NSTextAttachment
  • From: Timothy Ritchey <email@hidden>
  • Date: Fri, 02 May 2003 10:12:48 -0500

I have created a subclass of NSTextStorage, and have overridden:

-string
-attributesAtIndex:effectiveRange:
-replaceCharactersInRange:withString:
-setAttributes:range:

As a bit of background, instead of using an attributed string as the backing store for the text storage, I am using a tree created from a parse of an XML document, and am generating the attributes for the text on the fly as they are asked for in -attributesAtIndex:effectiveRange:

I am using attachments to represent the tags, so that an xml fragment like: <para>some text</para> will come out as \\u220fsome text\\u220f when -string is called in the text storage. I then return an NSTextAttachment in the attribute dictionary for the ranges that cover the NSAttachmentCharacters.

I have been banging my head on this for a day or so, and just can't get the text view to render my cells. It is completely ignoring them. In the rendering, I can see two small white spots where my attachment cells should be, but the cell instances are not being called at all as far as I can see. I had it all working with the normal text storage, so I am know that my NSTextAttachmentCell implementation is okay.

I have checked to make sure that the characters in the string match up with the attributes. For example, at index 0, the string is holding character \u220f, and the attribute dictionary is holding an NSTextAttachment object with my cell.

Is there some piece of the NSTextStorage pie that I am missing? Something more I should be implementing to support attachments? ANY help at this point would be appreciated.
_______________________________________________
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.
  • Follow-Ups:
    • Re: NSTextStorage and NSTextAttachment
      • From: Douglas Davidson <email@hidden>
  • Prev by Date: Strange Build Error
  • Next by Date: Re: Drag from view with nested view content
  • Previous by thread: Re: Strange Build Error
  • Next by thread: Re: NSTextStorage and NSTextAttachment
  • Index(es):
    • Date
    • Thread