應(yīng)用場景:自定義TabBar张症,設(shè)置button的點(diǎn)擊動(dòng)畫
/** 設(shè)置縮放動(dòng)畫 */
- (void)startScaleAnimation:(UIView *)view {
// 放大動(dòng)畫
[UIView animateWithDuration:0.2 animations:^{
view.transform = CGAffineTransformMakeScale(1.2, 1.2); //等比放大1.2倍
} completion:^(BOOL finished) {
// 縮回去動(dòng)畫
[UIView animateWithDuration:0.1 animations:^{
view.transform = CGAffineTransformIdentity; //回復(fù)原始狀態(tài)
} completion:^(BOOL finished) {
// 放大動(dòng)畫
[UIView animateWithDuration:0.08 animations:^{
view.transform = CGAffineTransformMakeScale(1.1, 1.1); //等比放大1.1倍
} completion:^(BOOL finished) {
// 縮回去動(dòng)畫
[UIView animateWithDuration:0.04 animations:^{
view.transform = CGAffineTransformIdentity; //回復(fù)原始狀態(tài)
}];
}];
}];
}];
}