2010-08-24 13 views
8

मैं खेलने के लिए नीचे दिए गए कोड का उपयोग ध्वनिदोहराने स्वचालित रूप से चलना

NSURL* musicFile = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"01" ofType:@"mp3"]]; 
AVAudioPlayer *audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:musicFile error:nil]; 
[audioPlayer play]; 

मैं जब यह खत्म कैसा है स्वचालित रूप से इस ध्वनि फ़ाइल दोहराना चाहते हैं?

+2

एक पाश में डाल दिया? – Chris

उत्तर

17
audioPlayer.numberOfLoops = someNumber; 

या के लिए छोरों की "अनंत" संख्या:

audioPlayer.numberOfLoops = -1; 
0
player.numberOfLoops = -1; 
[player prepareToPlay]; 

    [player play]; 
संबंधित मुद्दे