我正在尝试编写一个循环来检查每当音频 player.currenttime 增加 2 秒时它应该执行更新视图方法
- (void)myTimerMethod{
NSLog(@"myTimerMethod is Called");
myTimer = [NSTimer scheduledTimerWithTimeInterval:1.0
target:self
selector:@selector(checkPlaybackTime:)
userInfo:nil
repeats:YES];
}
- (void)checkPlaybackTime:(NSTimer *)theTimer
{
float seconds = audioplayer.currenttime;
NSLog(@"Cur: %f",audioPlayer.currentTime );
if (seconds = seconds + 2){
[self update view];
}
- (void)UpdateView{
if (index < [textArray count])
{
self.textView.text = [self.textArray objectAtIndex:index];
self.imageView.image = [self.imagesArray objectAtIndex:index];
index++;
}else{
index = 0;
}
}
如果音频 player.currenttimer 增加 2 秒,那么正确的写入方法是什么,然后执行此操作。
当前时间的 NSLog 始终显示 0.00。这是为什么。它应该随着音频播放器的播放而增加。
感谢帮助。