• 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: How to detect NSTextAttachment deletion
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to detect NSTextAttachment deletion


  • Subject: Re: How to detect NSTextAttachment deletion
  • From: Todd Ransom <email@hidden>
  • Date: Mon, 14 Jul 2008 12:52:54 -0400

Hello,

Take a look at the NSTextView delegate method shouldChangeTextInRange:replacementString:

The replacementString parameter will be blank (@"") on deletes, nil for attribute changes, and have a string on inserts or replacements of existing text.

This method is called before the actual change, so you can use the range passed in to determine whether an attachment will be deleted, then act on that information in the didChangeText method.

hope that helps,
Todd Ransom
StoryMill & Montage Development
Mariner Software




On Jul 14, 2008, at 12:37 PM, chaitanya pandit wrote:

Hi,
I am using a NSTextView and i programatically insert images as NSTextAttachments in the textView. These attachments are shown in an NSTextAttachmentCell by the NSTextView.
I want to do some background processing just before the user deletes the image from the textView. This can happen if the user simply hits the delete key or replaces the image with some string.
How can i detect if an NSTextAttachment or it's NSTextAttachmentCell is about to be removed from the textView?
Any help would be appreciated.
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


References: 
 >How to detect NSTextAttachment deletion (From: chaitanya pandit <email@hidden>)

  • Prev by Date: Re: How to detect NSTextAttachment deletion
  • Next by Date: Re: What is the best way?
  • Previous by thread: Re: How to detect NSTextAttachment deletion
  • Next by thread: CALayer transform, setting the Y value of rotation causes side-effects
  • Index(es):
    • Date
    • Thread