如何animationremoveFromSuperview
我用下面的animation显示了我的子视图:
CATransition *transition = [CATransition animation]; transition.duration = 0.3; transition.type = kCATransitionReveal; [webView.layer addAnimation:transition forKey:nil]; [self.view addSubview:webView];
但是现在我想删除我的子视图。 我如何添加animation来做到这一点? 像其他的CATransition一样? 什么时候添加这个? 在addSubview之前或之后?
那么你可以先做animation,然后在animationEndListener
调用removeFromSuperView
[UIView animateWithDuration:0.5 delay:1.0 options: UIViewAnimationOptionCurveEaseOut animations:^{ yourView.alpha = 0; }completion:^(BOOL finished){ [yourView removeFromSuperview]; }];