Re: Undo/Redo Notifications
Re: Undo/Redo Notifications
- Subject: Re: Undo/Redo Notifications
- From: Gordon Apple <email@hidden>
- Date: Sat, 22 May 2010 22:52:28 -0500
- Thread-topic: Undo/Redo Notifications
Well, I was hoping maybe someone could show me the obvious that I was
missing. :-) I guess I'm going to have to brush up on my undo handling,
especially since I'm also doing some programmatic edits.
I didn't use the popover for now, just did separate undo/redo buttons, which
works. But I would like to disable them if there is nothing in the
respective undo/redo stacks. Yup, I could always poll it for
canUndo/canRedo. Yeeech! That is in fact what I did for my 2-column font
picker. They provided the means to have dependent columns in the
PickerView, but no way to actually update them -- so I polled it. Works ok
for something sparsely used, but I hate to use polling for something in
long-term operation, like text editing.
I guess the advantage of a single undo button/popover is that is is more
like a Mac menu, although more persistent, allowing serial taps. It could
also allow for undo/redo titles, although I notice that Pages didn't bother
with such.
The docs are still pretty sparse. I didn't even realize that UITextView
supported undo/redo until I accidentally (who knows how) triggered an alert
asking if I wanted to undo typing. So I implemented it and, much to my
surprise, it worked.
On 5/22/10 8:02 PM, "Fritz Anderson" <email@hidden> wrote:
> On 22 May 2010, at 4:30 PM, Gordon Apple wrote:
>
>> So far, I don't see what I need for enabling/disabling undo/redo buttons in
>> iPhoneOS NSUndoManager. I want to implement an undo button/popover, a la
>> Pages, for a UITextView. I know I can read canUndo/canRedo, but I need an
>> active notification when undo status changes in order to enable/disable the
>> button and popover action buttons. What is the best way to get this,
>> preferably without subclassing UITextView? Available notifications don't
>> seem to be what I need.
>>
>> (MacOS usually does this when dropping a menu. That doesn't work here.)
>
> Tell us how the NSUndoManager...Notifications don't work for you. They apply
> only to actual undo/redo events, and the opening and closing of undo groups,
> but I'd have enough hope that the UIKit text system aggregated change events
> that I'd test to see if those notifications came through. Have you done that?
>
> Analogies to Mac OS menu validations don't work. It's pretty plain that Apple
> _really_ doesn't want to see menus in iPhone OS applications.
>
> Pages can do it (technically) because it doesn't rely on the text controls to
> modify text. Everything goes through the Pages event loop, so it knows
> independently whether something has been modified.
>
> Pages can do it as UI, on Apple's long-standing user-experience principle of
> Quod Licet Jovi Non Licet Bovi.
>
> If you really needed it, you could hold your nose and poll every half-second
> or so.
>
> F
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden