音乐播放器 播放进度【滑块 + 进度条】

//进度条
_progressView = [[UIProgressView alloc]initWithFrame:CGRectMake(50, 40, kSCREEN_WIDTH - 90, 3)];
// _progressView.tintColor = [UIColor grayColor];
[ctrlView addSubview:_progressView];

//进度滑块
_progressSlider = [[UISlider alloc]initWithFrame:CGRectMake(50, 40, _progressView.frame.size.width, 0)];
[_progressSlider addTarget:self action:@selector(sliderValueChanged:) forControlEvents:UIControlEventValueChanged];
[_progressSlider addTarget:self action:@selector(sliderStop:) forControlEvents:UIControlEventTouchUpInside];
//    self.videoSlider.maximumValue = CMTimeGetSeconds(duration);
UIGraphicsBeginImageContextWithOptions((CGSize){ 1, 1 }, NO, 0.0f);
UIImage *transparentImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

//    [_progressSlider setMinimumTrackImage:transparentImage forState:UIControlStateNormal];
[_progressSlider setMaximumTrackImage:transparentImage forState:UIControlStateNormal];
[ctrlView addSubview:_progressSlider];

你可能感兴趣的:(音乐播放器 播放进度【滑块 + 进度条】)