• 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
Insert NSImage into NSTextView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Insert NSImage into NSTextView


  • Subject: Insert NSImage into NSTextView
  • From: Matt Ball <email@hidden>
  • Date: Mon, 31 May 2004 12:51:31 -0400

In my app, the user sets the specifications for a shape to be drawn to
an imageView using BezierPaths. When the user presses OK, the image is
inserted into the textView. The code i am using is:

NSTextAttachmentCell *attachmentCell = [[NSTextAttachmentCell alloc]
initImageCell:[imageView image]];
NSTextAttachment *attachment = [[NSTextAttachment alloc] init];
[attachment setAttachmentCell: attachmentCell ];
NSAttributedString *attributedString = [NSAttributedString
attributedStringWithAttachment: attachment];
[[textView textStorage] appendAttributedString:attributedString];

This works well except for a few things. First, the app is not really
recognizing the image when it is inserted. Although it does get
inserted, the app doesn't see the document as edited. Secondly, and
this is probably a similar problem, the app will not let me drag the
image to other places in the textView to move it like I can with images
that have been dragged in. When I try to drag it, my Run window says:

-[NSTextView concludeDragOperation:]: Failed to read from drag
pasteboard. Drag operation failed.

Does anyone have any possible solutions to my problems? Thanks.

-- Matt Ball
_______________________________________________
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: Insert NSImage into NSTextView
      • From: Jeremy Dronfield <email@hidden>
  • Prev by Date: Re: beginSheetForDirectory problem
  • Next by Date: Re: IBOutlet appears as type NSObject?
  • Previous by thread: Re: NSSearchField Menu Enabling Troubles...
  • Next by thread: Re: Insert NSImage into NSTextView
  • Index(es):
    • Date
    • Thread