简体   繁体   中英

Trigger Shake Event in iOS SDK programatically

Is it possible to trigger the shake programatically? I am using the undo manager in my iOS app and its working fine when I shake the device. In addition, I would like to be able to provide a UIButton, so a user can trigger the undo manager without actually shaking the device.

Is this possible?

Thanks for any help,

I believe you can just call the -undo method on an instance of NSUndoManager , so set your button up to trigger that.

In addition, this tutorial may be helpful. It sets up an undo button as well as allowing shake to undo.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM