您的位置:首页 > 产品设计 > UI/UE

UIView延迟效果做出动画/UIView动画块

2016-03-14 00:00 183 查看
摘要: UIView延迟效果做出动画/UIView动画块



// 在规定时间 慢慢完成操作
[UIView animateWithDuration:1 animations:^{

self.button.backgroundColor = [UIColor orangeColor];

} completion:^(BOOL finished) {

// 完成回调后 还原来颜色
[UIView animateWithDuration:1 animations:^{

self.button.backgroundColor = [UIColor clearColor];
}];

}];

Demo下载演示

如果需要重复多次推荐这种方法

/**
animateWithDuration 多少时间完成动画

delay 延迟多久开始做动画
*/
[UIView animateWithDuration:1 delay:0 options:UIViewAnimationOptionAutoreverse animations:^{

// 动画重复次数
[UIView setAnimationRepeatCount:3];

self.button.backgroundColor = [UIColor purpleColor];

} completion:^(BOOL finished) {

// 完成回调后 还原颜色
[UIView animateWithDuration:1 animations:^{

self.button.backgroundColor = [UIColor clearColor];
}];

}];

点击下载演示
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: