//定义动画视图需要变化的大小和位置,用于指定最后iconButton 的frame
CGFloat w =self.view.bounds.size.width ;
CGFloat h = w ;
CGFloat y = (self.view.bounds.size.height - h )*0.5;
//开始动画
[UIView animateWith**Duration:**1.0f **animations**:^{
self.iconButton.frame = CGRectMake(0, y, w, h);
cover.alpha;
}];
animateWithDuration参数:
1、动画持续时间间隔
2、动画中需要改变的视图属性变化
// 动画一但定义,马上开始
[UIView animateWith**Duration**:1.0 **animations**:^{
// 将图像恢复初始位置
self.iconButton.frame = CGRectMake(85, 85, 150, 150);
cover.alpha = 0.0;
} **completion**:^(BOOL finished) {
// 动画完成之后删除cover
[cover removeFromSuperview];
}];
参数:
completion:动画完成后,需要执行的代码块