I have a drawing app in which I want to implement UNDO feature so that user can undo the last drawing stroke that has been done.
Can you please let me know how can this be done?
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
First of all please specify what do you use to draw. Do you use any API or Core-Graphics Framework for drawing.
Here are some of the approaches from the link I found.
Approach:
on touchesEnded, save the image to app sandbox with a name like.. 1.png, 2.png etc. then put a count on “undo” variable. when user press undo, just loads the old image base on the count. (this is what I can think of roughly, but haven’t gone through the coding of it yet, but sounds pretty simple to code).
NSUndoManager.
Hope this helps for anyone else looking to do this.
Reference Link:
http://www.iphonedevsdk.com/forum/iphone-sdk-development/46996-drawing-app-how-do-undo.html
Cheers