iOS中的动画-简单介绍

来源:互联网 发布:淘宝客服售前售后要点 编辑:程序博客网 时间:2024/06/06 21:27

iOS中有两种动画方式

第一种:头尾式

[UIView beginAnimations:nil context:nil];//设置动画持续时间[UIView setAnimationDuration:2.0];//动画执行完毕后,调用removeCover方法 (代理模式)[UIView setAnimationDelegate:self];[UIView setAnimationDidStopSelector:@selector(removeCover)];//要执行动画的代码//提交动画[UIView commitAnimations];

第二种

[UIView animateWithDuration:0.25 animations:^{    //存放需要执行动画的代码} completion:^(BOOL finished){    // 动画之行完毕后会自动调用这个block内部的代码}];
0 0
原创粉丝点击