I have a method that will analyze if a sound is above a certain decibel level, and if it is then do an action. I currently am currently calling this method as such
- (void) listen { .... }
The problem is that, I want the program to constantly be l开发者_如何学编程isten for noise, if the user choses to, not just when I call the method. Should I just hide a button in the background, and just leave it on, or is there an easier and more efficient way to do this.
You could always initialize a NSTimer to constantly trigger that check for you...
The timerWithTimeInterval:invocation:repeats:
method allows you to run it constantly.
精彩评论