iOS - 自定义滑动条

iOS - 自定义滑动条_第1张图片
0526EC9ADAE466F2096204D9BDC4EA58.jpg

self.slider = [[UISlider alloc] init];
_slider.minimumValue = 0.0;//下限
_slider.maximumValue = self.videoTime;;//上限
_slider.continuous = YES;
[self.view addSubview:_slider];
[_slider makeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(_avPlayer.bottom).offset(-10);
make.left.equalTo(_avPlayer.left).offset(14);
make.width.equalTo(WIDTH-28);
make.height.equalTo(10);
}];
[_slider addTarget:self action:@selector(sliderValueChanged:) forControlEvents:UIControlEventValueChanged];
_slider.thumbTintColor = HEXCOLOR(0xf7d721);
_slider.maximumTrackTintColor = HEXCOLOR(0xffffff);
_slider.minimumTrackTintColor = HEXCOLOR(0xf7d721);
[_slider setThumbImage:[UIImage imageNamed:@"WechatIMG909"] forState:UIControlStateNormal];
[_slider setThumbImage:[UIImage imageNamed:@"WechatIMG909"] forState:UIControlStateHighlighted];

你可能感兴趣的:(iOS - 自定义滑动条)