【发布时间】:2014-06-02 10:32:55
【问题描述】:
我有一个 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();
【问题讨论】:
标签: ios core-graphics drawingcontext