Skip navigation.
 
mlRe: PoseAsClass and NSColorWell (what Apple giveth, Apple taketh away...)
FROM : Jean-Daniel Dupas
DATE : Fri Mar 28 20:00:03 2008

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
}

Related mailsAuthorDate
mlPoseAsClass and NSColorWell (what Apple giveth, Apple taketh away...) Graham Cox Mar 28, 13:14
mlRe: PoseAsClass and NSColorWell (what Apple giveth, Apple taketh away...) Jeff Johnson Mar 28, 13:33
mlRe: PoseAsClass and NSColorWell (what Apple giveth, Apple taketh away...) glenn andreas Mar 28, 15:13
mlRe: PoseAsClass and NSColorWell (what Apple giveth, Apple taketh away...) Jean-Daniel Dupas Mar 28, 20:00