添加动画一 (上下包含法)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];
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。