0

我希望能够在设备晃动时在 iPhone 上显示图像。我可以播放声音,但也想同时弹出图像。
任何关于如何做到这一点的想法将不胜感激。

谢谢,韦斯

4

1 回答 1

0

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.

于 2010-05-10T10:10:14.657 回答