How to unset delegate on UIView setAnimationDelegate: call?
Posted
by morticae
on Stack Overflow
See other posts from Stack Overflow
or by morticae
Published on 2010-05-12T23:49:42Z
Indexed on
2010/05/12
23:54 UTC
Read the original article
Hit count: 480
I am receiving crash reports that appear to be from a UIView animation calling a delegate that has been dealloced.
Thread 0 Crashed:
0 libobjc.A.dylib 0x334776f6 objc_msgSend + 18
1 UIKit 0x31c566c4 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:]
2 UIKit 0x31c565d2 -[UIViewAnimationState animationDidStop:finished:]
3 QuartzCore 0x30045a26 run_animation_callbacks
I am setting the current view controller as the delegate for animations using the following pattern:
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDuration:0.5];
[UIView setAnimationDelegate:self];
...
[UIView commitAnimations];
My question is, how do I set that delegate reference to nil in my dealloc method? Is there some way to retain a reference to an animation? Or fetch animations in progress?
© Stack Overflow or respective owner