循环可可触摸中的声音
问题描述:
我有一个矩形按钮,当用户按下它一次。声音播放 但我想要它,所以当用户双击按钮时,声音连续循环直到用户决定按下停止声音。 这是播放声音的代码。循环可可触摸中的声音
- (IBAction)oneSound:(id)sender; {
NSString *path = [[NSBundle mainBundle] pathForResource:@"1" ofType:@"wav"];
if (theAudio) [theAudio release];
NSError *error = nil;
theAudio = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:&error];
if (error)
NSLog(@"%@",[error localizedDescription]);
theAudio.delegate = self;
[theAudio play];
}
谢谢!
这与Xcode没有任何关系(并且它是_is_“Xcode”,而不是“xCode”)。我会为你重新设计。 – 2011-04-17 18:06:06
很抱歉!史蒂夫乔布斯会杀了我,如果他看到了这一点。 – LAA 2011-04-17 18:49:10