【发布时间】:2013-02-05 08:55:24
【问题描述】:
我想通过循环播放多个文件。
我在下面写了代码..
请帮帮我!!...
soundList = [[NSArray alloc] initWithObjects:@"mySong1.mp3",@"mySong2.mp3",@"mySong3.mp3",@"mySong4.mp3",@"mySong5.mp3",@"mySong6.mp3",@"mySong7.mp3",@"mySong8.mp3",@"mySong9.mp3", nil];
for (i=0; i<=([soundList count] - 1); ) {
while(i<[soundList count]){
NSLog(@"File is : %@",[soundList objectAtIndex:i]);
mediaPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:[[NSURL alloc] initFileURLWithPath:[[NSBundle mainBundle] pathForResource:[soundList objectAtIndex:i] ofType:nil]] error:&error];
[mediaPlayer setDelegate:self];
self.lblCurrentSongName.text = [soundList objectAtIndex:i];
[mediaPlayer prepareToPlay];
i++;
}
}
请给我建议.!!..
【问题讨论】:
标签: iphone loops ios6 avaudioplayer