Re: Merging a an Objective-C class with other classes
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