1,簡單動畫
[UIView animateWithDuration:(NSTimeInterval) animations:^{
<#code#>
} completion:^(BOOL finished) {
code
}];
2,延時動畫
[UIView animateKeyframesWithDuration:(NSTimeInterval) delay:(NSTimeInterval)
options:(UIViewKeyframeAnimationOptions) animations:^{
<#code#>
} completion:^(BOOL finished) {
code
}];
delay表明延時的時間,單位是秒
UIViewKeyframeAnimationOptions經常使用:
// UIViewAnimationOptionCurveEaseInOut // default 快進快出
// UIViewAnimationOptionCurveEaseIn = 1 << 16, 快進
// UIViewAnimationOptionCurveEaseOut = 2 << 16, 快出
// UIViewAnimationOptionCurveLinear 勻速
3,transform
label.transform = CGAffineTransformMakeTranslation(0, label.height);
label.transform = CGAffineTransformIdentity;
常配合二段動畫(簡單動畫+延時動畫)使用
CGAffineTransformMakeTranslation 往座標移動
CGAffineTransformIdentity 迴歸原位置