views:

587

answers:

1

In iPhone OS 3.0, UIApplication allows you to set a applicationSupportsShakeToEdit flag. The documentation says "The default value is YES. Set the property to NO if you don’t want your application to display the Undo and Redo buttons when users shake the device."

This is all great and it ties in to the new NSUndoManager class nicely. However - I don't want to use the built in NSUndoManager in my app! I'm writing a drawing app, and I already have an undo/redo manager that does some fancy stuff (it manages the data required for each undo operation, and will page it to disk if the app is low on memory). I'd much rather just listen for a notification from the UIApplication and trigger undo myself. (I could just make a bogus NSUndoManager, but I also don't want the "Are you sure?" panel to show...)

Does anyone know if such a notification exists? I figure it must - but I can't find it documented anywhere. Is there a way to monitor all notifications going through the app, maybe?

Thanks!

+1  A: 

You may well have solved this issue by now, but in case someone comes across this searching for a Shake solution as I did I laid out how you can get the 3.0 Shake event messsages easily in this thread:

http://stackoverflow.com/questions/150446/how-do-i-detect-when-someone-shakes-an-iphone

It outlines how you can respond to shake without using an UndoManager or presenting the Undo API. Even if you set applicationSupportsShakeToEdit to NO, these events will still be received..

Kendall Helmstetter Gelner