• 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: Merging a an Objective-C class with other classes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Merging a an Objective-C class with other classes


  • Subject: Re: Merging a an Objective-C class with other classes
  • From: "Stephen Deken" <email@hidden>
  • Date: Tue, 23 Jan 2007 11:42:19 -0600

On 1/23/07, Mark Alldritt <email@hidden> wrote:
I what to share a common
implementation of cut:, copy:, paste: and other methods across all these
classes.

There are a few ways to approach this, some of which are uglier than others.

One way is to use a common delegate which implements the high-level
logic, and call the delegate whenever your shared commands are called.
The delegate can call back into the sender for any extra information
it needs.

Another way is to use the objective-c methods to bend the runtime to
your will by actually declaring, at run time, that your view objects
really do have the target methods, all pointing to the same actual
implementation.  This will cause warnings about possibly not
responding to selectors, though.

You might also just implement a category anyway, and filter out
anything that's not your target classes by poking at [self class] in
the method.

--
Stephen Deken
email@hidden
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: 
 >Merging a an Objective-C class with other classes (From: Mark Alldritt <email@hidden>)

  • Prev by Date: Merging a an Objective-C class with other classes
  • Next by Date: NSTextView Lucida Grande/Helvetica problem
  • Previous by thread: Merging a an Objective-C class with other classes
  • Next by thread: Re: Merging a an Objective-C class with other classes
  • Index(es):
    • Date
    • Thread