NSAnimation subclass calling display on a view
NSAnimation subclass calling display on a view
- Subject: NSAnimation subclass calling display on a view
- From: "David Alter" <email@hidden>
- Date: Mon, 24 Nov 2008 11:11:05 -0800
I'm creating an animation using NSAnimation. I have created a subclass of
NSAnimation that over loads setCurrentProgress. The delegate is a subclass
of NSImageView. When setCurrentProgress gets called I call my delegate
display method. My drawRect method in my subclass of NSImageView identifies
if we are animating and draws accordingly.
//Here is where I create an instance of my animation subclass. I'm using the
default settings for blocking.
myAnimationSubclass = [[MyAnimation alloc] initWithDuration:0.5
animationCurve:NSAnimationEaseInOut];
[myAnimationSubclass setDelegate:delegate];
// Run the animation synchronously.
[myAnimationSubclass startAnimation];
//This is from my subclass of NSAnimation
- (void)setCurrentProgress:(NSAnimationProgress)progress {
[super setCurrentProgress:progress];
[[self delegate] display];
}
//This is from my subclass of NSImageView
- (void)drawRect:(NSRect)rect {
if(![myAnimationSubclass isAnimating]) {
[super drawRect:rect];
} else {
//Do my drawing stuff
}
}
My drawRect method is not being called until the animation is complete. It
was my understanding that calling display would force an immediate redrawing
of the NSView, or subclass of NSImageView in this case. This would result in
calling drawRect. However setCurrentProgress is getting called several times
but drawRect is not being called. Resulting in no animation.
I'm clearly missing something but I'm not sure what it is. If you have any
ideas please let me know.
thanks
-dave
_______________________________________________
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