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
}
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 mails | Author | Date |
|---|---|---|
| Graham Cox | Mar 28, 13:14 | |
| Jeff Johnson | Mar 28, 13:33 | |
| glenn andreas | Mar 28, 15:13 | |
| Jean-Daniel Dupas | Mar 28, 20:00 |






Cocoa mail archive

