我有控制器,其中使用CAKeyframeAnimation
随机掉落大量的图片,我应该通过触摸轨迹裁剪这张图片, 使用CALayer
为目前的动画图像的任何动画和我试图检测使用[layer presentationLayer]
触摸此层内部的事件。检测触摸事件
问题是 - 为了裁剪这个图像,我应该从我的触摸跟踪器片段和图层创建路径,我还不知道如何创建这条路径,但这里的问题是如何检测到这个接触点在下降CALayer
坐标系统,附图更丰富。
任何想法?
为了检测与控制相关层的触摸点坐标,我使用此代码系统:
- (void) touchesMoved:(NSSet *)touches :(CGPoint) movingPoint :(UIEvent *)event
{
NSArray *layers = [[contextView layer] sublayers];
for (CALayer *layer in layers) {
CGRect imageRect = [[layer presentationLayer] frame];
if(CGRectContainsPoint(imageRect, movingPoint)) {
NSLog(@"Image position - x %f y %f", movingPoint.x, movingPoint.y);
}
}
}
是的,你是对的,我很想念这个事实,但你告诉我方向。谢谢! – Eugene