nsundomanager

Undo typing in UITextView

I'm using iPhone SDK 3.0. Say, I enabled 'shake to undo' by setting application.applicationSupportsShakeToEdit to YES in my app delegate. I created an UITextView in RootViewController and had it become first responder upon app launch. I use - (BOOL)textView:(UITextView *)aTextView shouldChangeTextInRange:(NSRange)range replacementText:...

Problem with NSUndoManager

I read the chapter on undo/redo in the Hillegass book. He only goes over document based applications though. I am using pretty much the same code that is in the book, but I get "appController may not respond to -undoManager" when I use the code below. I know that I have to create an Undo Manager explicitly, but exactly how do I do this...

NSUndoManager undo Not Working With Core Data

Hi there, I am trying to create an iPhone application where the user can add entries. When he presses a new entry, a box will popup asking him for some information. Then he can either press "Cancel" or "Save" to discard the data or save it to disk. For saving, I am using the Core Data framework, which works pretty well. However, I cann...

NSUndoManager with Core Data - Redo not working

I have a Core Data document-based app which support undo/redo via the built-in NSUndoManager associated with the NSManagedObjectContext. I have a few actions set up which perform numerous tasks within Core Data, wrap all these tasks into an undo group via beginUndoGrouping/endUndoGrouping, and are processed by the NSUndoManager. Undo wo...

NSManagedObject relationship undo

I have a NSManagedObject ObjA that has a many-to-many relationship with another NSManagedObject ObjB. I initialize it with [NSEntityDescription insertNewObjectForEntityForName:@"ObjA" inManagedObjectContext:app.context]; When I perform undo without performing save - the object is not added to the persistent store. But - when I add an i...

Multiple undo managers for a text view

Hi, I've a text view that gets its content from an attributed string stored in a model object. I list several of these model objects in a drawer and when the user clicks on one the text view swaps its content. I now need to also swap the undo manager for the text view. I initialise an undo manager on my model object and use undoManager...

Serialize state data from NSUndoManager on iPhone

I've got undo/redo set up in my iphone app, and now I'm looking at saving state, so when the user exits the app and then starts it up again, everything is in the same state, including the undo/redo stack. I don't see any obvious way to serialize the NSUndoManager. Is there a good way to accomplish this? ...

Undo/Redo using NSUndoManager in iPhone SDK

Hi, I have been trying to design the Undo/Redo functionality in one of my app using NSUndoManager class and seeing some design difficulties. In my app, I just have one method -(IBAction) addLastBall:(Ball *)ball So, when a user chooses a button in the UI, I add a ball object to my array list. However, I don't have any action button to...

Core Data undo coalescing for an action spanning multiple run loop cycles

I have a Core Data based UIKit application that allows the user the drag objects around on the screen. While an object is being dragged, I update its position attribute on each touchesMoved: event. To support undoing a drag operation in one go, I start a new undo group at the beginning of the drag, and end the group when the user lifts ...

Is it possible to implement mutliple NSUndoManager for one NSWindow?

Hi, I have a window with multiple views (they all subclass NSView and there is always only one visible) on which i draw paths. I'd like to have an NSUndoManager for each view, but obviously they all have the same NSUndoManager, coming from the NSWindow. Is this even possible? Thx xonic ...

Getting Notifications of isDocumentEdited

Hello, is it possible to bind/get notifications of the isDocumentEdited property of NSDocument without calling the will/didChangeValueForKey: methods on every change? ...

Shake Gesture detection in UIWindow subclass takes over default text undo manager

What I want is having my iPhone app aware of shaking gesture all the time except when any UITextfield or UITextview become firstResponder. (I followed this: http://stackoverflow.com/questions/150446/how-do-i-detect-when-someone-shakes-an-iphone/1351486#1351486I) I subclass UIWindow and implemented motionEnded:withEvent: method and it w...

Does NSUndoManager work on iPhone without shake gestures?

I have an app that uses the shake gesture for something else besides undo. I want to use NSUndoManager and all the examples and how-tos say I have to put the following line in my applicationDidFinishLaunching method. application.applicationSupportsShakeToEdit = YES; Is it possible to use NSUndoManager without supporting the shake to u...

NSUndoManager and enabling/disabling an undo button

In my iOS application's interface I have explicit undo & redo button (shake-to-undo is a pretty heavyweight action and in this context, undos are performed pretty frequently). Normally, I would use KVO to observe NSUndoManager's canUndo and canRedo key paths and enable & disable the buttons as the notifications come in. Unfortunately, NS...

iOS 4 Application Termination and Undo

What is a good way to handle iOS 4 app termination when using an NSUndoManager? I have an iPhone (iOS 4) application that uses Core Data. The app allows the user to edit managed objects, and I implement undo using NSUndoManager in a straightforward manner: Before displaying an editor view modally, I create a new NSUndoManager for the ma...

core data and undo errors plus no redo...

So the issue: I drop a some items into an editor area it creates an undo grouping...under the covers, as the whole process of dropping the items is actually a collection of tasks. If I then delete the tasks, I am given an option to undo the delete. If I do this undo I get an error in the console: _endUndoGroupRemovingIfEmpty:: NSUndoMa...

What is the proper way to be notified of a Core Data model object being restored after a deletion?

I've got an elegant system set up using Core Data where any time a property of a model object is changed it is automatically reflected in its associated view using key-value observing but I have ran into a problem using undo. The problem occurs when I have deleted a model object. The associated view is destroyed along with all the key-v...

NSUndoManager stops undoing in certain conditions

Im trying to implement an undo manager in my app using Core Data. Instead of making my own UndoManager im using the default undo manager in my ManagedObjectContext. Because of that i am not registering any actions manually, neither am i beginning or ending any undo groups. Undo works fine for most conditions however at certain conditions...

how to implement undo using NSUndoManager? (newbie question)

Im trying to add an NSUndoManager to my program but im not sure how to register the methods with the manager using : [myUndoManager registerUndoWithTarget:selector:object:]; what if i have the following method: -(IBAction)tapButton:(id)sender { myFoo++; yourFoo++; //incrementing integers fooFoo++; } how can i regist...

Can't successfully register undo from NSTextField

I have a simple document-based application that simply creates a custom XML file. It uses an Outline View to navigate the XML document. When an item in the Outline View is selected a custom view is displayed as a sub view of the document view that allows the user to enter in data. On one of the views has a NSTextField. It has its "Al...