我有一个UIImageView
是动画和接收UITapGestureRecognizer
。 问题是动画的同时,敲击手势区域不与视图中移动。 我可以点击视图的原始位置和点击手势被识别。 任何人都知道如何有水龙头的认可,而鉴于移动,而不是在原来的位置?
编辑1:这是我如何设置我的双击手势识别:
UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(viewTapped:)];
tapRecognizer.cancelsTouchesInView = YES;
tapRecognizer.numberOfTapsRequired = 1;
tapRecognizer.delegate = (id)self;
[imageView addGestureRecognizer:tapRecognizer];
imageView.userInteractionEnabled = YES;
有没有办法有手势识别跟着我认为它的道路上,因为我的动画持续几秒钟? 我错过了设置?
编辑2:这是我的代码来设置我的动画:
double width = backgroundImageView.frame.size.width;
double height = backgroundImageView.frame.size.height;
CGMutablePathRef path = CGPathCreateMutable();
double startX = -imageView.frame.size.width;
double startY = height/4;
double endX = 3*width;
double endY = 0;
double duration = 40;
CGPathMoveToPoint(path, NULL, startX, startY);
CGPathAddLineToPoint(path, NULL, endX, endY);
CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"position"];
animation.duration = duration;
animation.path = path;
animation.repeatCount = HUGE_VALF;
[imageView.layer addAnimation:animation forKey:@"theAnimation"];