动画设置

2016-12-22  本文已影响0人  哎呦哎呦小葵花

添加动画一 (上下包含法)beginAnimatioins


[UIView beginAnimations:nil context:nil];

[UIView setAnimationDuration:2.0f]; // 时间间隔

[UIView setAnimationDelegate:self]; // 设置为代理还可以设置一些代理方法

[UIView setAnimationWillStartSelector:@selector(willStart)];

[UIView setAnimationDidStopSelector:@selector(stop)];

// 设置需要做的动画

[UIView commitAnimations];

添加动画二 block方法


[UIView animateWithDuration:2.0f animations:^{

 // 设置需要做的动画

}];

添加动画三 block方法二


[UIView animateWithDuration:2.0f animations:^{

// 设置需要做的动画

} completion:^(BOOL finished) {

// 做完动画需要做什么事

}];

添加动画四 系统自带对于某些特殊情况 - setContentOffset:animated;


CGPoint point = self.scrollView.contentOffset;

point.y = self.scrollView.frame.size.height;

[self.scrollView setContentOffset:point animated:YES];

上一篇 下一篇

猜你喜欢

热点阅读