I have a UIView which i animate the movement of it's frame. However, now, i want to change the alpha value so its fades out as it moves... The alpha needs changing back at the end of the animation. My first thought was to use an animationDidStop Selector but, this View is only in scope where the animation block is... i.e. in the Stop selector, it fails.
I can't use an instance variable as there are several views i do this for, and to have ivars for each is messy.
My question is can you pass an object to a Stop select开发者_JAVA技巧or and control the animation of that object?
I only want to change the alpha as there is some lag as the new frame is rendered.
The docs suggest your selector should be of the form
(void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context
So when you set the animationDidStopSelector I'd pass the view as context
so you can change it.
The context is set in the beginAnimations call. So set the context as the view you want to animate and hey presto..
精彩评论