我想在我的iPhone应用程序中添加撤消按钮,我该怎么做?

时间:2023-01-19 16:58:53

i am using he quartz for drawing the image in my view and now i want to add the undo button in my toolbar button on myipad app.

我正在使用他的石英在我的视图中绘制图像,现在我想在myipad应用程序的工具栏按钮中添加撤消按钮。

what is code or any example of doing this.

什么是代码或任何这样做的例子。

2 个解决方案

#1


2  

NSUndoManager has been available since iPhone OS 3.0

NSUndoManager自iPhone OS 3.0起可用

http://developer.apple.com/iphone/library/documentation/cocoa/reference/Foundation/Classes/NSUndoManager_Class/Reference/Reference.html

http://developer.apple.com/iphone/library/documentation/cocoa/reference/Foundation/Classes/NSUndoManager_Class/Reference/Reference.html

http://developer.apple.com/iphone/library/documentation/Cocoa/Conceptual/UndoArchitecture/Articles/iPhoneUndo.html

http://developer.apple.com/iphone/library/documentation/Cocoa/Conceptual/UndoArchitecture/Articles/iPhoneUndo.html

#2


0  

Store the old state in a stack. When the undo button is pressed, pop the stack and restore the state. Disable the undo button when the stack is empty. Be careful not to run out of memory.

将旧状态存储在堆栈中。按下撤消按钮时,弹出堆栈并恢复状态。堆栈为空时禁用撤消按钮。小心不要耗尽内存。

What constitutes "old state" is probably very specific to your application.

什么构成“旧状态”可能非常特定于您的应用程序。

#1


2  

NSUndoManager has been available since iPhone OS 3.0

NSUndoManager自iPhone OS 3.0起可用

http://developer.apple.com/iphone/library/documentation/cocoa/reference/Foundation/Classes/NSUndoManager_Class/Reference/Reference.html

http://developer.apple.com/iphone/library/documentation/cocoa/reference/Foundation/Classes/NSUndoManager_Class/Reference/Reference.html

http://developer.apple.com/iphone/library/documentation/Cocoa/Conceptual/UndoArchitecture/Articles/iPhoneUndo.html

http://developer.apple.com/iphone/library/documentation/Cocoa/Conceptual/UndoArchitecture/Articles/iPhoneUndo.html

#2


0  

Store the old state in a stack. When the undo button is pressed, pop the stack and restore the state. Disable the undo button when the stack is empty. Be careful not to run out of memory.

将旧状态存储在堆栈中。按下撤消按钮时,弹出堆栈并恢复状态。堆栈为空时禁用撤消按钮。小心不要耗尽内存。

What constitutes "old state" is probably very specific to your application.

什么构成“旧状态”可能非常特定于您的应用程序。