lundi 9 février 2015

Recording audio while button is held down

I'm wondering what is the best way for me to record sound while the user is holding down a UIButton. (i.e. start when the user is holding down and stop when he releases the button). Will something like this work?


Function call



button.addTarget(self, action: "holding:", forControlEvents: .TouchDown)


Function:



func holding (sender:UIButton!) {

// Sound recording code here

}


Also I'm trying to update a UIProgressView as the sound is recorded. Is there a way I can access the amount of time (in seconds / milliseconds) that has elapsed since the recording has started? Can I just use my own timer or will there be some dependency?


Aucun commentaire:

Enregistrer un commentaire