如何“撤消”当我们使用iPhone SDK时? [英] How to "undo" when we draw in iPhone SDK?

查看:68
本文介绍了如何“撤消”当我们使用iPhone SDK时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个绘图应用程序,我想在其中实现UNDO功能,以便用户可以撤消已完成的最后一个绘图笔划。

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?

谢谢

推荐答案

首先所有请注明您使用什么绘画。您是否使用任何API或Core-Graphics框架进行绘图。

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.

方法:


  1. on touchesEnded,将图像保存到应用程序沙箱中,其名称为..png,2.png等。 变量。当用户按undo时,仅基于计数加载旧图像。 (这是我可以大致想到的,但是还没有经过编码,但是听起来很简单)。

  1. 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。

NSUndoManager.

希望这对希望这样做的人有所帮助。

Hope this helps for anyone else looking to do this.

参考链接:

http://www.iphonedevsdk.com/forum/iphone-sdk-development/46996-drawing-app-how-do-undo.html

欢呼

这篇关于如何“撤消”当我们使用iPhone SDK时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆