使用AVAudioPlayer现在可以在音频文件中播放音频文件,当audioplayer到达音频文件的特定当前时间或位置时,我可以跟踪它,然后它应该更新视图控制器。
这是我的代码,但它不起作用,因为没有更新viewcontrollers。
float seconds = audioPlayer.currentTime;
if (seconds == 11.0){
[self performSelector:@selector(FirstViewController) withObject:nil];
} else {
if (seconds == 23.0){
[self performSelector:@selector(secondViewController) withObject:nil];
}
}
-(void)FirstViewController {
FirstViewController *viewController = [[FirstViewController alloc] init];
viewController.view.frame = CGRectMake(0, 0, 320, 480);
[self.view addSubview:viewController.view];
[self.view addSubview:toolbar];
[viewController release];
}
请帮忙