views:

39

answers:

1

I want to be able to display an image on the iPhone when the device is shaken. I can play a sound but also want to pop up an image at the same time.
Any ideas on how to do this would be appreciated.

thx, wes

A: 

How I would do it?

  1. In your header file, define an UIImageView.
  2. When your device is shaken, init the view with the right frame
  3. Load an image in that UIImageView.
  4. Add that UIImageView to the view that is currently shown.
  5. Create a NSTimer which has an interval of the time you want to show your image
  6. When the timer hits its interval, remove the imageview from the view.

I am not putting all kinds of code here, because you also supply no code whatsoever, but I think you can figure it out yourself.

Wim Haanstra