Undo/Redo for drawing in iOS
I am working on a drawing app, I want to do Undo/Redo, for this I am saving CGPath on touches ended to NSMutableArray, But I am not understanding how I should render the CGPaths on click of Undo button EDIT1: As I am using BezierPaths, So, I first decided to go with a simple approach of just stroking this path, without CGPath, EDIT2: As my Undo is happening in segments(i,e in parts and not whole path is deleted), I decided to create an array of array, So I have made changes accordingly and now I will be drawing in CGlayer, with taking CGPath So here "parentUndoArray" is array of arrays. So I