开发者

Display an image for a few seconds

开发者 https://www.devze.com 2022-12-29 12:11 出处:网络
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.

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?

  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.

0

精彩评论

暂无评论...
验证码 换一张
取 消