第一种:根据代码,自己逐步设置
[UIView beginAnimations:nil context:nil];//加入动画效果
[UIView setAnimationDuration:2.0];//动画持续时间
self.headBtn.frame = rect;//输入变化的内容————————————这一行注意放的越后面执行的动画越多
[UIView commitAnimations];//提交动画
第二种:直接用block封装代码
[UIView animateWithDuration:2 animations:^{ //用block的方式实现动画
self.headBtn.bounds = rect; //输入变化的内容
}];