标签:style color io for ar cti log ad
用处:在一个连续的区间中选择一个值
-(void)viewDidLoad
{
[super viewDidLoad];
CGRect frame = CGRectMake(20,20,200,0);
self.slider = [[UISlider alloc]initWithFrame:frame];
//设置最小值
self.slider.minimumValue = 0;
//设置最大值
self.slider.maximumValue = 100;
//设置当前值
self.slider.value = 50;
//是否连续触发事件处理
self.slider.continuous = YES;
//最小端颜色
self.slider.minimumTrackTintColor = [UIColor redColor];
//最大段颜色
self.slider.maximumTrackTintColor = [UIColor greenColor];
//滑块颜色
self.slider.thumbTintColor = [UIColor blackColor];
//添加值改变事件方法
[self.slider addTarget:self action:@selector(change:) forControlEvents:UIControlEventValueChanged];
[self.view addSubView:self.slider];
}
-(IBAction) change:(id)sender
{
UISlider * slider = (UISlider*)sender;
float value = slider.value;
NSLog(@"%f",value);
}
标签:style color io for ar cti log ad
原文地址:http://www.cnblogs.com/AngryCooder/p/3895018.html