I want to be able to display an image on the iPhone when the dev开发者_StackOverflowice 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
How I would do it?
- In your header file, define an UIImageView.
- When your device is shaken, init the view with the right frame
- Load an image in that UIImageView.
- Add that UIImageView to the view that is currently shown.
- Create a NSTimer which has an interval of the time you want to show your image
- 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.
精彩评论