使用UIBezierPath擦除线条图

Ton*_*shi 2 iphone cocoa-touch

使用UIBezierPath进行线条绘制的简单应用程序,但现在需要一种方法来擦除使用UIBezierPath绘制的线条.有没有办法实现橡皮擦功能去除线条画?

Vee*_*Raj 6

如果您使用图像作为背景,那么您可以设置与画笔图案相同的图像来绘制贝塞尔曲线,它实际上会为您提供橡皮擦效果.这个对我有用.:)

    brushPattern=[[UIColor alloc]initWithPatternImage:[UIImage imageNamed:@"image.jpg"]];
    // Here image.jpg is you background image
Run Code Online (Sandbox Code Playgroud)