转场动画:
CATransition *ca = [CATransition animation];
ca.type = @"cube";
ca.subtype = kCATransitionFromRight;
ca.endProgress = 0.5;
ca.duration = 1;
[self.iconView.layer addAnimation:ca forKey:nil];
组动画:
// 平移动画
CABasicAnimation *a1 = [CABasicAnimation animation]
a1.keyPath = @"transform.translation.y"
a1.toValue = @(100)
// 缩放动画
CABasicAnimation *a2 = [CABasicAnimation animation]
a2.keyPath = @"transform.scale"
a2.toValue = @(0.0)
// 旋转动画
CABasicAnimation *a3 = [CABasicAnimation animation]
a3.keyPath = @"transform.rotation"
a3.toValue = @(M_PI_2)
// 组动画
CAAnimationGroup *groupAnima = [CAAnimationGroup animation]
groupAnima.animations = @[a1, a2, a3]
groupAnima.duration = 2
groupAnima.fillMode = kCAFillModeForwards
groupAnima.removedOnCompletion = NO
[self.iconView.layer addAnimation:groupAnima forKey:nil]
UIView的转场动画
[UIView transitionWithView:self.view duration:1.0 options:0 animations:^{
NSLog(@"animations");
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.view cache:YES];
} completion:^(BOOL finished) {
NSLog(@"completion");
}];