0

I am having trouble directing the undos from a UITextView to the UIDocument's undo manager.

As I understand it when a user types in the UITextView it should register the undo with the closest undoManager in the responder chain, however I have added overrides to the undoManager methods in the text view itself, the containing view, view controller and window that log and return the superclass result, and I placed breakpoints in these overrides, but they are never called and they never log.

Nevertheless, all changes made in this text editor are infact undoable, so they must be stored in an undo manager somewhere. How does UITextView find it's undo manager? and how can I make sure it is pointed at my document so that the saved changes works as they should?

Piyush Dubey
  • 2,416
  • 1
  • 24
  • 39
user1043479
  • 288
  • 1
  • 10
  • Have a look at this:- http://stackoverflow.com/questions/5079490/ios-uitextview-nsundomanager – Piyush Dubey Dec 27 '13 at 06:22
  • @PiyushDubey Thank you, but as I described in the question, I have already overloaded that method to see if it is called, and it is not, so the method described in that answer does not work. – user1043479 Dec 27 '13 at 11:40
  • UITextView has a special NSUndoManager subclass, UITextUndoManager, which does the magic. You can add category to NSUndoManager as https://gist.github.com/hoshi-takanori/8193202 for logging, etc. – hoshi Dec 31 '13 at 06:12

0 Answers0