本文共 1267 字,大约阅读时间需要 4 分钟。
通过自身调自身这种方法实现的动画经常出各种问题,现在改用GCD延迟下调自身这种方法:
/**
* 动画效果
*/
//- (void)circularCharingAnimation
//{
// NSLog(@"--------------------------------------");
// if (self.circularStopFlag) return;
// [UIView animateWithDuration:2.0 animations:^{
//
// self.circularImageView.alpha = 0.0;
// self.circularImageView.frame = CGRectMake(0, 0, 260.0, 260.0);
// self.circularImageView.center = self.cycleView.center;
//
// } completion:^(BOOL finished) {
// self.circularImageView.alpha = 1.0;
// self.circularImageView.frame = CGRectMake(0, 0, 184.0, 184.0);
// self.circularImageView.center = self.cycleView.center;
// [self circularCharingAnimation];
// }];
//}
- (void)circularCharingAnimation
{
if (self.circularStopFlag) return;
[UIView animateWithDuration:2.0 animations:^{
self.circularImageView.alpha = 0.0;
self.circularImageView.frame = CGRectMake(0, 0, 260.0, 260.0);
self.circularImageView.center = self.cycleView.center;
}];
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC));
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
self.circularImageView.alpha = 1.0;
self.circularImageView.frame = CGRectMake(0, 0, 184.0, 184.0);
self.circularImageView.center = self.cycleView.center;
[self circularCharingAnimation];
});
}
转载地址:http://omkob.baihongyu.com/