• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Developing for Tiger and Panther;
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Developing for Tiger and Panther;


  • Subject: Re: Developing for Tiger and Panther;
  • From: Ben Dougall <email@hidden>
  • Date: Thu, 28 Jul 2005 15:43:44 +0100


On Tuesday, July 26, 2005, at 11:30 pm, Matt Budd (Madentec) wrote:

Hello,

I want to use the new NSAnimation in my code, but my app has to run in both Tiger and Panther. I've rolled my own Animation class that works similiar to NSAnimation (i.e. notifying the delgate when it hits a certain point in the animation), so I was hoping to be able to use my own class on Panther, and then the NSAnimation class (with bettter implementations) on Tiger.

What is the best way to do this in code. I would prefer one executable instead of having to create two different Targets in my Xcode project. Is there a run-time check to say whether I am running on 10.3 versus 10.4? I have my project set to "Cross-Develop using Target SDK: Mac OS X 10.3.9", since that is miminum requirement.

Thanks for any info...

one thing that might help: classes can be stored in and accessed from variables. so you can do:


Class animationClassToUseAtRuntime; // a variable of type Class

if( system is less than tiger ) { 	// however that should be done
	animationClassToUseAtRuntime = [YourAnimationClass class];
} else {
	animationClassToUseAtRuntime =  NSClassFromString(@"NSAnimation");
}

then this for example:

id a = [[animationClassToUseAtRuntime alloc] init];

will create an instance of the appropriate animation class. this will only work properly i think if your animation class's interface is the same as NSAnimation's interface -- not sure if they would have to be fully the same or if you could get away with partially the same.

so throughout the code from then on for the animation class you always use the animationClassThatWillBeUsedAtRuntime class variable and it'll always be the right one. polymorphism is the technical term for this i think.

you could do the above OS test and class variable assignment at the start of your app's run and have the class variable as a global variable so it'll work throughout the app and you only have to check once.

this is just a suggestion -- there might be a better way.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Developing for Tiger and Panther;
      • From: "Matt Budd (Madentec)" <email@hidden>
References: 
 >Developing for Tiger and Panther; (From: "Matt Budd (Madentec)" <email@hidden>)

  • Prev by Date: NSComboBox subclass text field?
  • Next by Date: Re: Capturing mousedown in WebFrameView
  • Previous by thread: Re: Developing for Tiger and Panther;
  • Next by thread: Re: Developing for Tiger and Panther;
  • Index(es):
    • Date
    • Thread