Recipe: Building a Better Text Editor (Part I)
Undo support and persistence help create better text editors in your application. These features ensure that your users can reverse mistakes and pick up their work from where they left off. Accomplishing them requires surprisingly little programming, as demonstrated in Recipe 6-7.
Text views provide built-in support that works hand-in-hand with select, cut, copy, and paste. The undo manager understands these actions, and possible user messages might include Undo Paste, Redo Cut, and so forth. All the view controller needs to do is instantiate an undo manager; it leaves the rest of the work to the built-in objects.
Recipe 6-7 adds Undo and Redo buttons to the keyboard accessory view. These buttons ...
Get The Core iOS Developer’s Cookbook, Fifth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.