I was following this great tutorial at ray wenderlich's site about creating a simple drawing app with UIKit. http://www.raywenderlich.com/18840/how-to-make-a-simple-drawing-app-with-uikit
the tutorial is great and everything is working. the problem that I have is that when it came to creating the eraser functionality the solution proposed by ray was to use the brush with the same color that the background has. To me this doesn't seem like a great solution. what if the background is not a solid color like a gradient or any image like in so many coloring book apps.
So basically the question is: is there a way to remove color (convert all pixels in that area to transparent maybe) from a UIImageView at a given location?
Any help or pointers would greatly be appriciated. Thanks
Use the brush but for the color use:
I could solve the issue using below code:
Reference
I have the same issue in my app after the long search i found the simple solution for this issue.
i just used touches methods of the
UIViewController
The below is the my approach,
Code:-
The Inputs:
The simple solution of your problem will be :-
Note:
This not unerase it again drawing the image over
Update:-
this will be like this....