Re: Using deprecated methods
Re: Using deprecated methods
- Subject: Re: Using deprecated methods
- From: Jean-Daniel Dupas <email@hidden>
- Date: Sat, 5 Jul 2008 14:26:17 +0200
Le 5 juil. 08 à 14:08, Keith Blount a écrit :
Hi,
Something that has bothered me for ages in Cocoa, but which I've
always put to one side, is how to handle certain deprecated methods
when supporting more than one OS. In some instances it's as simple
as checking at runtime which OS is being used and using the
appropriate method accordingly, but I'm wondering here about the
trickier instances. For instance:
I am currently overhauling printing in my application. I have a page
layout accessory view and I now also want to add a print panel
accessory view. My app runs on both Tiger and Leopard. -
setAccessoryView: works on both Tiger and Leopard, for adding an
accessory view to both NSPageLayout and NSPrintPanel. However, in
both cases, -setAccessoryView: was (rather frustratingly in this
case, I feel, as it worked fine) informally deprecated on Leopard.
Instead, we are advised to use -addAccessoryViewController:, which
uses an NSViewController. But the NSViewController class doesn't
even exist on Tiger, so subclassing it and having it in the project
will cause the app not to run on Tiger at all.
What make you think so ? You cna perfectly use 10.5 only symbol and
target 10.4 as long as you check that this symbol exist before your
use it.
if (MyLeopardOnlyFunction)
MyLeopardOnlyFunction(foo, bar, other);
You just have to be sure that your properly configure your project,
that is set SDK to th emax target version( 10.5) and set deployment
target to the min version (10.4)
So you just have to do something like this:
if ([myPanel
respondsToSelector:@selector(addAccessoryViewController:)] ) {
// go the nsviewcontroller way
} else {
// use the old way
}
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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