簡單的總結(jié)下自己學(xué)習(xí)動畫的知識:
對于UIview的動畫
[UIView animateWithDuration:20.0animations:^{
? ? label.alpha=0.1;
}completion:^(BOOLfinished) {
? ? if(finished)
? ? {
? ? ? ? NSLog(@"hello");
? ? }
}];
如果label不在當(dāng)前屏幕上肆饶,那么動畫會執(zhí)行completion,但是finished是no馍迄。
對于cabaseanimation的理解和簡單使用http://www.reibang.com/p/02c341c748f9;這篇文章足以句喜,下面說下我之前的疑惑:
1 對于fromValue 和 toValue
?fromValue ?變化的起始值胖眷,如:NSValue 或者 NSNumber 類型
toValue 變化的結(jié)束值,與fromValue相對應(yīng)。
2 對于 animationWithKeyPath
keyPath 即所要改變的對象的屬性许昨,如 x ,y褥赊,opacity 等糕档,但是frame不能直接改變,因?yàn)閒rame由point 和 bounds 共同影響拌喉,但可以通過設(shè)置point 和 bounds 來共同設(shè)置速那。