views:

30

answers:

1

how to do undo on touch event...

I draw a line using touchesBegan,touchesMoved and touchesEnded.....

Now I want to do undo operation to get my previous state on iphone....

any one can help me how do undo operations on iphone?

thanks in advance....

+2  A: 

You will have to do this manually when the undo message is sent. You need to keep a history of what's been drawn, most likely in a stack.

Then, just pop with the undo call and restore the view.

The stack should probably just hold the layers, so you can remove them from super on pop.

DexterW
Thanks Greelmo....UIGraphicsPopContext()UIGraphicsPushContext(<#CGContextRef context#>)I guess i need to implement this methods for undo operations....
kiran