Animated audio play button on iPhone
I am playing audio in my app through FMOD. In my media player I currently just have a play button with a slider that tracks your progress through the audio clip. What I want to do is have basically a slider that wraps around the play button, showing the progress there.
For example, the play button in jplayer: http://www.jplayer.org/
I have looked around but have not found any libraries out there or any tutorials on how to implement this in Objective-C.
Any hel开发者_高级运维p/suggestions?
Here are some pages you might find useful.
- Intro to Quartz - explains the basics of drawing with Quartz
- Drawing Pie Charts - explains how to draw arcs of circles
- Advanced Drawing Guide - for making it look pretty
Basically, using these tutorials, you should be able to draw the arc of a circle behind your play button, which extends outside the button itself. The angle of the arc should be the percentage of the progress through the audio file as a float (i.e. 0.0 to 1.0), multiplied by 360 degrees.
Do keep in mind the user interface implications of this design. Having a circular progress bar will make it very difficult for the user to seek to different parts of the audio file, if that's a feature you support.
精彩评论