本文主要是介绍UISlider 滑动条,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
//滑块 音量设置,播放进度UISlider *slider = [[UISlider alloc] initWithFrame:CGRectMake(0, 30, 300, 50)];//滑块左边的颜色slider.minimumTrackTintColor = [UIColor redColor];//滑块右边的颜色slider.maximumTrackTintColor = [UIColor greenColor];UIImage *thumb = [UIImage imageNamed:@"round_30"];//设置滑块的图片[slider setThumbImage:thumb forState:UIControlStateNormal];[slider setThumbImage:thumb forState:UIControlStateHighlighted];//gitHubs//google-code//source-forge//stackoverflow//设置最大值和最小值slider.maximumValue = 100;slider.minimumValue = 0;//设置默认值slider.value = slider.maximumValue / 2;[slider addTarget:self action:@selector(change:) forControlEvents:UIControlEventValueChanged];
- (void)change:(UISlider *)slider
{//获取当前进度float value = slider.value;NSLog(@"value = %f", value);
}
这篇关于UISlider 滑动条的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!