本文介绍了将UISlider.value设置为AVPlayer.currentTime的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将UISlider的值设置为AVPlayer的当前时间。
I am trying to set a UISlider's Value to a AVPlayer's Current Time.
我正在尝试使用此代码 audioPlayer.currentTime = nowPlayingSlider .value;
I am trying to use this code audioPlayer.currentTime = nowPlayingSlider.value;
我收到此错误:
使用属性分配给对象需要Setter方法赋值语法
如何让它工作。
I am getting this error:
Setter method is needed to assign to object using property assignment syntax
How do I get this to work.
推荐答案
这里是我如何处理这个:
Here is how I handled this:
-(IBAction) timeScrubberChange:(id) sender{
CMTime t = CMTimeMake(self.nowPlayingTimeScrubber.value, 1);
self.nowPlayingCurrentTime.text = [self formatTimeCodeAsString: t.value];
self.nowPlayingDuration.text = [self formatTimeCodeAsString:(self.actualDuration - t.value)];
[self.avPlayer seekToTime:t];
}
这篇关于将UISlider.value设置为AVPlayer.currentTime的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!