Is it possible to record set of touch events on iPhone and then playback? I have searched alot but could not find any answer. if its possible, can anyone explain with an example. I m not looking for testing purpose. Within my application, instead of creating animation, i just want to record set of events and then want to playback to explain the app flow to the users.
Regards.
Recording is pretty simple. Look at the various "Responding to Touch Events" and "Responding to Motion Events" methods on UIResponder. Just create your own UIView subclass (since UIView
inherits from UIResponder
) and keep a copy of the events passed into the relevant methods.
Playback is a bit more complicated; there's no way to make UITouch
or UIEvent
objects (so you can't make a fake event and pass it on to -[UIApplication sendEvent:]
). But, there's nothing stopping you from manually parsing an array of Event objects and handling it on your own (aside from it being some kind of ugly code).