0

私はそのレイヤーの上に描画したい 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();
4

1 に答える 1