标签:style blog color io ar for sp div on
- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. _mySlider = [[UISlider alloc]initWithFrame:CGRectMake(0, 0, 200, 23)]; _mySlider.center = self.view.center; _mySlider.minimumValue = 0.0f; _mySlider.maximumValue = 100.0f; _mySlider.value = _mySlider.maximumValue/2.0; [self.view addSubview:_mySlider]; }
Value这个属性是可以读写的.如果你想要滑块用动画的方式移动到某个值,可以调用 slider 的 setValue:animated: 方法同时传递参数 YES 。
//thumb 每次移动时都接收到一个事件 [_mySlider addTarget:self action:@selector(sliderValueChange:) forControlEvents:UIControlEventValueChanged];
- (void)sliderValueChange:(id)sender{ NSLog(@"%f",_mySlider.value); }
_mySlider.continuous = NO;
[_mySlider setThumbImage:[UIImage imageNamed:@"ThumbNormal.png"] forState:UIControlStateNormal]; [_mySlider setThumbImage:[UIImage imageNamed:@"ThumbHighlighted.png"] forState:UIControlStateHighlighted];
标签:style blog color io ar for sp div on
原文地址:http://www.cnblogs.com/safiri/p/4015445.html