【发布时间】:2016-10-15 13:34:12
【问题描述】:
我正在做这样的动画:
CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"position"];
animation.duration = 100.0;
animation.path = self.animationPath.CGPath;
[view.layer addAnimation:animation forKey:@"animation"];
工作正常,但是,现在尝试检测在屏幕上移动的对象上的触摸时会失败:
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event
{
for (UIView* subview in self.subviews ) {
if ( [subview hitTest:[self convertPoint:point toView:subview] withEvent:event] != nil ) {
[self handleTap];
return YES;
}
}
return NO;
}
它失败是因为视图的框架不再与它在动画时在屏幕上的明显位置相同。如何让pointInside 使用正在动画的视图?
【问题讨论】:
标签: ios uiview core-animation caanimation cakeyframeanimation