//声音控制
MPVolumeView *_sliderVolume = [[MPVolumeView alloc] initWithFrame:CGRectMake(0.0, 0.0, 150.0, 19.0)];
self.sliderVolume = _sliderVolume;
self.sliderVolume.center = CGPointMake(player_width - player_width / 4 , BOTTOM_BAR_HEIGHT / 2 + 10);
//self.sliderVolume.
[self.ctrlBottomView addSubview:self.sliderVolume];
[_sliderVolume release];
UIImage *imgMaxTrackV = [UIImage imageNamed:@"soundline_01.png"];
UIImage *imgMinTrackV = [UIImage imageNamed:@"soundline_02.png"];
UIImage *imgCtrButtonV = [UIImage imageNamed:@"processline_03_copy.png"];
for (UIView *view in [_sliderVolume subviews]){
if ([[[view class] description] isEqualToString:@"MPVolumeSlider"]) {
UISlider *vs = (UISlider *)view;
//自定义处理
vs.minimumValue = 0.0;
vs.maximumValue = 100.0;
[vs setMaximumTrackImage:imgMaxTrackV forState:UIControlStateNormal];
[vs setMinimumTrackImage:imgMinTrackV forState:UIControlStateNormal];
[vs setThumbImage:imgCtrButtonV forState:UIControlStateNormal];
break;
}
}
自定义MPVolumeView控件
最新推荐文章于 2021-05-29 04:39:44 发布