I am trying to design undo / redo functions in my app using the NS Undo Manager class and some designs Looking at the difficulties. In my app, I have a method
- (IBAction) addLastBall: (ball *) ball Therefore, when a user chooses a button Ui, I add a ball object to my array list. However, I do not have any action button to remove the ball, this is a UI workflow design and it can not be changed. Therefore, to implement an egg, I called the following part of the code inside the addLastBall method
[undoManager registerUndoWithTarget: self selector: @selector (removeBall :) object: ball]; After doing this, the removeball method is called with the ball object when the user is tried to undo is now good for everyone but, I am not sure again How to manage the part again, when the user tries to do it again, I'm not sure which method will be called because I need to add the ball object, the user only Removed using undo operation. Any information will be very useful.
Thank you very much.
Performs undo works recorded again when executing a re-associated re-related. Therefore, the simplest solution is that the removeBall: method is just for registering a revised action.
- (empty) Deleted Ball: (Ball *) Ball [[Andu Manager Academy Register: Auto Selector: @Selector (Adlstball :) Object: Ball]; ...} Note that sometimes it is clear to use the prepareWithInvocationTarget: to register the undo functions:
[[UndoManager preparation with the goal of: Self] AddListball: ball]; By the way, make sure that removeBall: be sure to maintain the ball above zero - the undone manager will not make the ball for you, and If it is removed, then eliminating the removal will crash.
Comments
Post a Comment