简体   繁体   中英

How can I implement undo functionality in my painting application for iOS?

I developed a painting application for iPad. I have tried in many ways to implement undo functionality in my app, but I couldn't. I tried to save every drawing object as an image by capturing the screen in the touchesEnd: method. I can save all these drawn objects in an array and while doing undo I can display the previous drawn object image by adding it as a subview of my drawing view. Until now, it has been working fine, but after adding that image to my view I couldn't draw any more. I have enabled the userInteraction property for the ImageView , also, but I still couldn't draw.

How can I change that ImageView to allow drawing after doing undo?

One option is to create core data objects for your drawing operations and then use the core data undo manager. Have a look here: http://www.mikeabdullah.net/core_data_undo_management.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM