简体   繁体   中英

UIView animatewithDuration - Remove Animation

I have a recursive UIView animatewith duration: delegate to run an animation. When the view disappears I''m supposed to stop this animation. [self.view.layer removeAllAnimation] doesn't seem to help. ANy other means to stop animation?

What about using the method [UIView animateWithDuration:animations:completion:] ? You can check inside the completion block if the view has disappeared. If it hasn't - run one more animation iteration.

This solution i came across is based on the UIObject. I added the UIObject to an NSMutableArray on starting the animation. When I leave that view call for [NSMutableArray * removeObject]; inside viewDidDisappear.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM