Re: Developing for Tiger and Panther;
Re: Developing for Tiger and Panther;
- Subject: Re: Developing for Tiger and Panther;
- From: Sherm Pendley <email@hidden>
- Date: Thu, 28 Jul 2005 11:53:39 -0400
On Jul 28, 2005, at 11:08 AM, Matt Budd (Madentec) wrote:
You're right, this is exactly how I did it at first and everything
worked. The problem happens when instead of using NSAnimation
directly I want to use a subclass of NSAnimation. As per your example:
if( system is less than tiger ) { //can actually test if
(NSClassFromString(@"NSAnimation") == nil)
animationClassToUseAtRuntime = [YourAnimationClass class];
} else {
animationClassToUseAtRuntime = NSClassFromString
(@"MyOtherAnimatoinClassThatIsNSAnimationSubclass");
}
Even though if I am running on Panther, I never execute the else-
condition of that statement, the app still crashes because it have
code for my "MyOtherAnimatoinClassThatIsNSAnimationSubclass" class
that is a subclass of NSAnimation.
Compile your MyAnimationSubclass into a bundle, and dynamically load
that bundle at runtime. Something like this:
... } else {
NSString *pluginPath = [[NSBundle mainBundle] builtInPlugInsPath];
NSString *bundlePath = [pluginPath
stringByAppendingPathComponent:@"MyNSAnimationSubclass.bundle"];
NSBundle *animClassBundle = [NSBundle bundleWithPath:bundlePath];
Class animationClass = [animClassBundle principalClass];
}
sherm--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
_______________________________________________
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