• 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
textView, writeCell to clipboard, how to read from clipboard
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

textView, writeCell to clipboard, how to read from clipboard


  • Subject: textView, writeCell to clipboard, how to read from clipboard
  • From: Alexander Reichstadt <email@hidden>
  • Date: Mon, 16 Jul 2012 22:15:06 +0200

Hi,

in NSTextView there is a method to handling writing textattachmentcells to the clipboard. I implemented the following and it seems to work:

- (NSArray *)textView:(NSTextView *)aTextView writablePasteboardTypesForCell:(id <NSTextAttachmentCell>)cell
              atIndex:(NSUInteger)charIndex;
{
    return [NSArray arrayWithObject:kDataCellTypeUTI];
}

- (BOOL)textView:(NSTextView *)aTextView
       writeCell:(id <NSTextAttachmentCell>)cell
         atIndex:(NSUInteger)charIndex
    toPasteboard:(NSPasteboard *)pboard type:(NSString *)type;
{
    if (type == kDataCellTypeUTI)
        [pboard writeObjects:[NSArray arrayWithObject:cell]];

    return YES;
}


Both get overridden and my custom textattachmentcell ends up on the pasteboard. But when pasting it and even though it does get pasted as a cell, the custom properties are the default values and not the ones from the copy on the pasteboard. initWithPasteboardPropertyList is never called nor initWithCoder, only the standard init method. The cell subclass subscribes to NSPastboardReading and -Writing protocol and implements all methods thereof. IS there anything else that needs to be done, or are textattachmentcells an exception to the pasteboard in some way?

AR
_______________________________________________

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

  • Prev by Date: Re: -[NSFileHandle readInBackgroundAndNotify] opens the file again
  • Next by Date: Re: +bundleForClass: category question
  • Previous by thread: Re: Cocoa-dev Digest, Vol 9, Issue 488
  • Next by thread: NSTextAttachment
  • Index(es):
    • Date
    • Thread