準備動畫
參數1, 動畫的做用 (區分多個動畫); 參數二, 傳遞參數用 nil (用於UI) NULL(用於C語言)
[UIView beginAnimations:@"改變大小" context:NULL ];
設置動畫的代理
[UIView setAnimationDelegate:self];
設置後代理的方法(willstart)將不會執行
[UIView setAnimationWillStartSelector:@selector(start)];
動畫延遲執行時間
[UIView setAnimationDelay:0];
設置動畫的曲線
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
動畫重複次數
[UIView setAnimationRepeatCount:5.5];
自動往返 (必須重複次數大於1)
[UIView setAnimationRepeatAutoreverses:YES];
在準備動畫的時候, 能夠設置動畫屬性
[UIView setAnimationDuration:0.5];
2.修改view的屬性 (不是全部的屬性能夠修改),
frame / center / alpha / bounds / transform / backgroundcolor 能夠用時修改多個屬性
self.changeView.frame = CGRectMake(10, 10, 100, 100);
self.changeView.backgroundColor = [UIColor redColor];
3.提交動畫
[UIView commitAnimations];ide