如何通过更新标签中的滑块值来移动滑块来更新AVAudio记录器?

时间:2018-12-04 07:06:19

标签: objective-c avaudioplayer uislider

if(isPlaying == NO)

{

[_ playBtn setImage:[UIImage imageNamed:@“ pause”]   forState:UIControlStateNormal];

    [audioPlayer play];
   // UISlider *mySlider = _playSlider;

    _playSlider.value = audioPlayer.currentTime


    _playStartLbl.text = [NSString stringWithFormat:@"0:%d",(int)(audioPlayer.currentTime)];

    [_playSlider setMaximumValue:(int)(audioPlayer.duration)];

    NSLog(@"Current Time:%d",(int)(audioPlayer.duration));
    _playEndLbl.text = [NSString stringWithFormat:@"0:%d",(int)(audioPlayer.duration)];

}

else

{
    [_playBtn setImage:[UIImage imageNamed:@"play"] forState:UIControlStateNormal];
    [audioPlayer pause];
    _playSlider.value = 0;

}
isPlaying = !isPlaying;

}

0 个答案:

没有答案