android中的控件叫做seebar
#pragma mark - 加载视图
- (void)viewDidLoad {
[super viewDidLoad];
//android seekbar
CGRect frame = CGRectMake(20, 20, 200, 0);
self.mySlider = [[UISlider alloc] initWithFrame:frame];
//限制值
self.mySlider.minimumValue = 0;
self.mySlider.maximumValue = 100;
//修饰行为
self.mySlider.continuous = YES;
//当前值是50
self.mySlider.value = 50;
//修饰外观
//最小端颜色
self.mySlider.minimumTrackTintColor = [UIColor orangeColor];
//最大端颜色
self.mySlider.maximumTrackTintColor = [UIColor redColor];
//滑块颜色
self.mySlider.thumbTintColor = [UIColor greenColor];
[self.mySlider addTarget:self action:@selector(change:) forControlEvents:UIControlEventValueChanged];
[self.view addSubview:self.mySlider];
}
#pragma mark - 做todo事件
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark -
-(IBAction)change:(id)sender{
UISlider *slide = (UISlider *)sender;
float value = slide.value;
NSLog(@"value is %f", value);
}