redo

Undo/redo with a UITextView (iOS/iPHone)

不打扰是莪最后的温柔 提交于 2019-11-30 05:31:06
I have a view where a UITextView always has focus. What I want to do is extend the built-in undo/redo behavior to support undo/redo for when I programmatically set the text (e.g., for when I clear it, by setting it to @""). Since only the firstResponder gets undo/redo events, I thought I'd simply use the UITextView's undoManager property to create my invocations. e.g., // Before clearing the text... [[self.myTextView.undoManager prepareWithInvocationTarget:self] undoClear:self.myTextView.text]; [self.myTextView.undoManager setActionName:@"Clear"]; // ... -(void)undoClear:(NSString *

What is the purpose of redo and retry statements in Ruby?

橙三吉。 提交于 2019-11-30 04:50:35
问题 The only use case I can think of for redo would be for operations like writing to a socket or reading from a database, but if these fail once, subsequent attempts will most likely also fail so it still seems a bit pointless to me and as for retry I can't really think of any case where it would be useful. This might only seem meaningless to me since I don't know or use Ruby, but I aspire to create an awesome language one day so I would like to at least know reasoning behind design of some of

how to implement undo/redo operation without major changes in program

左心房为你撑大大i 提交于 2019-11-29 09:09:29
问题 Hi I'm about to add new functionality to application which I'm currently writting. I need to write a undo/redo fnctionality. However 90% of our application is ready and I don't know what is the best way to implementing this functionality without affectig(too much ) code which has been already created. 回答1: There aren't many details here. However, Undo/Redo functionality is typically handled via some variation of the Command Pattern. Depending on your architecture, this could be a simple

Undo/redo with a UITextView (iOS/iPHone)

谁说我不能喝 提交于 2019-11-29 04:16:42
问题 I have a view where a UITextView always has focus. What I want to do is extend the built-in undo/redo behavior to support undo/redo for when I programmatically set the text (e.g., for when I clear it, by setting it to @""). Since only the firstResponder gets undo/redo events, I thought I'd simply use the UITextView's undoManager property to create my invocations. e.g., // Before clearing the text... [[self.myTextView.undoManager prepareWithInvocationTarget:self] undoClear:self.myTextView.text

How to design undo & redo in text editor?

匆匆过客 提交于 2019-11-27 21:23:33
Part of my project is to write a text editor that is used for typing some rules, compiling my application and running it. Writing compiler was end and release beta version. In the final version we must add undo and redo to the text editor. I use a file and save it periodically for the text editor. How to design undo and redo to my text editor? What is changed in the structure of persistent of file? Jordão You can model your actions as commands , that you keep in two stacks. One for undo, another for redo. You can compose your commands to create more high-level commands, like when you want to

How to design undo & redo in text editor?

孤街浪徒 提交于 2019-11-27 04:30:46
问题 Part of my project is to write a text editor that is used for typing some rules, compiling my application and running it. Writing compiler was end and release beta version. In the final version we must add undo and redo to the text editor. I use a file and save it periodically for the text editor. How to design undo and redo to my text editor? What is changed in the structure of persistent of file? 回答1: You can model your actions as commands, that you keep in two stacks. One for undo, another