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

Re: NSTextView paste:


  • Subject: Re: NSTextView paste:
  • From: ecir hana <email@hidden>
  • Date: Tue, 14 Aug 2012 10:25:50 +0200

On Tue, Aug 14, 2012 at 2:43 AM, Seth Willits <email@hidden> wrote:

>
> - (BOOL)readSelectionFromPasteboard:(NSPasteboard *)pboard type:(NSString
> *)type
> {
>         if ([type isEqual:NSStringPboardType]) {
>                 if ([[pboard stringForType:type] isEqual:@"foo"]) {
>                         NSRange range = [self selectedRange];
>
>                         if ([self shouldChangeTextInRange:range
> replacementString:@"bar"]) {
>                                 [self replaceCharactersInRange:range
> withString:@"bar"];
>                         }
>
>                         return YES;
>                 }
>         }
>
>         return [super readSelectionFromPasteboard:pboard type:type];
> }
>
>
This works great, thanks a lot!
_______________________________________________

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: 
 >NSTextView paste: (From: ecir hana <email@hidden>)
 >Re: NSTextView paste: (From: Seth Willits <email@hidden>)
 >Re: NSTextView paste: (From: ecir hana <email@hidden>)
 >Re: NSTextView paste: (From: Seth Willits <email@hidden>)

  • Prev by Date: Re: Classes incompatible with weak references
  • Next by Date: Re: Alternative method for makeViewWithIdentifier
  • Previous by thread: Re: NSTextView paste:
  • Next by thread: Re: NSTextView paste:
  • Index(es):
    • Date
    • Thread