WeChatFloat
WeChatFloat copied to clipboard
定时器销毁时机问题
} else if (self.edgePan.state == UIGestureRecognizerStatePossible) {
///这个位置的代码不应该在动画结束后销毁定时器,否则会在动画过程中继续回调定时器,多次UIGestureRecognizerStatePossible
状态
[self.floatArea removeFromSuperview];
self.floatArea = nil;
[self.link invalidate];
self.link = nil;
[UIView animateWithDuration:0.5 animations:^{
self.floatArea.frame = CGRectMake(SCREEN_WIDTH, SCREEN_HEIGHT, kFloatAreaR, kFloatAreaR);
} completion:^(BOOL finished) {
if (self.showFloatBall) {
self.floatViewController = self.tempFloatViewController;
if ([self haveIconImage]) {
self.floatBall.iconImageView.image = [self.floatViewController valueForKey:@"hk_iconImage"];
}
self.floatBall.alpha = 1;
[kWindow addSubview:self.floatBall];
}
}];
}