应用场景:自定义TabBar,设置button的点击动画
/** 设置缩放动画 */
- (void)startScaleAnimation:(UIView *)view {
// 放大动画
[UIView animateWithDuration:0.2 animations:^{
view.transform = CGAffineTransformMakeScale(1.2, 1.2); //等比放大1.2倍
} completion:^(BOOL finished) {
// 缩回去动画
[UIView animateWithDuration:0.1 animations:^{
view.transform = CGAffineTransformIdentity; //回复原始状态
} completion:^(BOOL finished) {
// 放大动画
[UIView animateWithDuration:0.08 animations:^{
view.transform = CGAffineTransformMakeScale(1.1, 1.1); //等比放大1.1倍
} completion:^(BOOL finished) {
// 缩回去动画
[UIView animateWithDuration:0.04 animations:^{
view.transform = CGAffineTransformIdentity; //回复原始状态
}];
}];
}];
}];
}
网友评论