`NSUndoManager` is a general-purpose recorder of operations for undo and redo.
Questions tagged [nsundomanager]
222 questions
7
votes
1 answer
"[NSBigMutableString substringWithRange:]: Range {0, 10} out of bounds; string length 9" error with Undo
My app crashes when I try to do undo on UISearchBar. In my app I have code to prevent entering a '%' sign on the search bar and for doing this it replaces a % to @"" in textDidChange method as below:
- (void)searchBar:(UISearchBar *)searchBar…

tech_human
- 6,592
- 16
- 65
- 107
7
votes
1 answer
Core Data - undoing changes after saving a context
I've recently noticed this strange thing about undo mechanism in Core Data and it's bothering me ever since.
A quote from NSManagedObjectContext documentation for -undo method:
Sends an undo message to the receiver’s undo manager, asking it to…

secondcitysaint
- 1,158
- 12
- 20
6
votes
1 answer
Difficulty implementing NSUndoManager redo function
I'm trying to implement an NSUndoManager in my iOS app. I got the undo functionality to work, but not the redo part. I'm quite new to iOS development and this is the first time that I've used NSUndoManager so it's probably something trivial.
My app…

Anders
- 2,903
- 7
- 58
- 114
6
votes
1 answer
Nested undo group with CoreData
I want to add a undo manager to a coredata backed iphone application. When the user tries to add a new object (by tapping on + button) I load a new modal viewcontroller and start a new undo group in viewDidLoad.
When the user presses Cancel button,…

siasl
- 497
- 1
- 8
- 17
6
votes
5 answers
Disable undo/redo in Cocoa app
I've implemented undo/redo the standard way (NSUndoManager) but can't figure out how I disable undo/redos when my app is in a specific state.
Users draw things in my app and when what they've drawn is uploading I disable the UI and of course don't…

Sebastian
- 891
- 2
- 11
- 19
6
votes
2 answers
can't get wxHaskell to work from ghci on Mac
I'm trying to run an example using EnableGUI function.
% ghci -framework Carbon Main.hs
*Main> enableGUI >> main
This is what I get instead of a working program:
2013-01-14 00:21:03.021 ghc[13403:1303] *** Assertion failure in +[NSUndoManager…

Valentin Golev
- 9,965
- 10
- 60
- 84
6
votes
1 answer
NSUndoManager: redo not working
I am making a simple application that uses a NSSlider, which can be put to it's max or min value with two buttons.The undo manager shall track all changes and allow to undo/redo all changes made using these two buttons.
Here is the interface: …

Ramy Al Zuhouri
- 21,580
- 26
- 105
- 187
5
votes
4 answers
Core Data and NSOperation
I'm currently working with an NSPersistentDocument subclass that uses NSOperation to import data in the background. As per the documentation, I'm observing the NSManagedObjectContextDidSaveNotification after saving in the background task and…

chockenberry
- 7,811
- 5
- 32
- 41
5
votes
4 answers
How to perform undo operation in iOS for storing the UIGraphicsContext?
I want to perform undo operations on the graphics context in my drawing app. When undo is pressed i want to move to the previous context that contains the old drawing.
For Example:
I have a rectangle in the context. On dragging, I move the rectangle…

Vinayak Kini
- 2,919
- 21
- 35
5
votes
1 answer
NSUndoManager and How Do I get the Redo Working
I have an app where I want to save the current state of a project before every change so that undo and redo will be able to step back and forth within those states. When I make a change the code to save the position is:
if(!undoManager){
…

box86rowh
- 3,415
- 2
- 26
- 37
5
votes
1 answer
Undo operation with NSUndoManager in rich UITextView (iOS 6)
I want to change some or all of the attributed text of a rich UITextView (iOS 6), and allow the user to undo the change.
After reading NSUndoManager documentation, I tried the first way:
“Simple undo” based on a simple selector with a single…

Guillaume
- 21,685
- 6
- 63
- 95
4
votes
3 answers
Removing undo actions for a WebView's NSUndoManager
I have several WebViews that I swap in and out of my view hierarchy. Some of these WebViews contain form fields, so I implement the editingDelegate to provide the NSUndoManager for my document.
The problem is that any typing done in the WebView…

chockenberry
- 7,811
- 5
- 32
- 41
4
votes
2 answers
UndoManager's canUndo property not updating in SwiftUI
Why does the @Environment UndoManager not update its canUndo property when it has actions in its stack? I have a view that has a child that can utilize the un/redo functionality, but for some reason I can't disable the undo button based on the…

PointOfNilReturn
- 416
- 4
- 13
4
votes
1 answer
Undo action names for Core Data changes
I'm looking for a built-in (or easy-to-implement) way to get Core Data undo/redo action names to read like "Undo edit First Name", rather than simply "Undo" or "Redo" as they do by default.
I have a Core Data application, and am using its…

Dov
- 15,530
- 13
- 76
- 177
4
votes
2 answers
NSUndoManager casting NSUndoManagerProxy crash in Swift code
In our application we're using the following code:
let lInvocationTarget = lUndoManager.prepare(withInvocationTarget: self)
let _ = (lInvocationTarget as! MyObjectType).myMethod(_: self.opacity, undoManager: lUndoManager)
This compiles without…

Marius
- 258
- 1
- 9