美文网首页
动画设置

动画设置

作者: 哎呦哎呦小葵花 | 来源:发表于2016-12-22 22:59 被阅读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];

相关文章

网友评论

      本文标题:动画设置

      本文链接:https://www.haomeiwen.com/subject/bswhvttx.html