我有一个 CAShapeLayer,我想在该层上方绘制。我采用 UIImageView 并添加到该 CAShapelayer 上,现在我开始绘制,因为用户触摸在该 CAShapelayer 路径内移动。但是当用户触摸结束时,我想以这样的方式合并 CAShape 层上的绘制图像视图,如果用户再次点击,然后使用 hitTest 方法,我可以再次获得 cashape 层的路径。
// tempDrawingImage 是我在命中层上方添加的图像视图。
UIGraphicsBeginImageContext(tempDrawingImage.frame.size);
[hitLayer drawInContext:UIGraphicsGetCurrentContext()];
[tempDrawingImage.image drawInRect:tempDrawingImage.frame];
hitLayer.contents = (id) UIGraphicsGetImageFromCurrentImageContext().CGImage;
UIGraphicsEndImageContext();