Re: PoseAsClass and NSColorWell (what Apple giveth, Apple taketh away...)
Re: PoseAsClass and NSColorWell (what Apple giveth, Apple taketh away...)
- Subject: Re: PoseAsClass and NSColorWell (what Apple giveth, Apple taketh away...)
- From: Jean-Daniel Dupas <email@hidden>
- Date: Fri, 28 Mar 2008 20:00:03 +0100
Le 28 mars 08 à 13:33, Jeff Johnson a écrit :
Graham,
If you're just overriding one or two methods of NSColorPanel, you
could use the technique I describe here:
http://lapcatsoftware.com/blog/2007/11/25/working-without-a-nib-part-6-working-without-a-xib/
It uses the Apple-documented function
method_exchangeImplementations() in the Leopard Objective-C runtime,
so it should be supported for the foreseeable future.
Note that this function might not be available in the Tiger
Objective-C runtime. If you use the 10.5 SDK, that won't be a
problem. If you still need to support Tiger, however, I don't
really know of any 'future-proof' technique. It's highly unlikely
that Apple would or could kill poseAsClass in a 10.5.x update, so it
will continue to work in both Tiger and Leopard, though it's already
dead in the Leopard 64-bit runtime.
You want a futur proof way on Tiger, use weak linking:
if (method_exchangeImplementations) {
// do it the Leopard way
} else {
// do it the Tiger way
}
_______________________________________________
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