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:(NSString *)text
to make changes to the text view according to what the user types. The problem is that it messed up the default undoing action. Shaking the device no longer display 'Undo Typing'.
I tried to create an undo manager myself but have yet to success. Nothing shows up when I shake my device, even though I had the undo manager registered some actionprepareWithInvocationTarget
.
Anyone has an idea?
EDIT: I have checked WriteRoom for iPhone's behavior and also TextExpander Touch SDK example code, both of which display the Undo option upon shaking until an auto-completion is made. That is, when a change is commited to the textView via setText:, I guess. So, changing the textView's content indeed has some effects on the undo mechanism.
EDIT 2: The question is that: How could I incorporate the undo feature in this case?