IOS UISlider and iOSUISlider
UISlider is a convenient control that allows you to visually set values in a specified range.
Like buttons, the slider can also respond to events and be read as a text box. If you want the user to adjust the slider to immediately affect the application, you need to trigger the operation.
We will learn from the following aspects:
UISlider * slider = [[UISlider alloc] initWithFrame: CGRectMake (10,100,300, 50)]; // 01. minimumValue: When the value can be changed, the slider can slide to the minimum position value, the default is 0.0 slider. minimumValue = 0.0; // 02. maximumValue: the slider that slides to the maximum position when the value can be changed. The default value is 1.0 slider. maximumValue = 100.0; // 03. current Value slider. value = 50; // 04. continuous: If YES is set, the value of the slider changes whenever the slider is dragged. The default value is YES [slider setContinuous: YES]; // 05. the image set at the minimum value of the slider bar. The default value is nil slider. minimumValueImage = [UIImage imageNamed: @ "001.jpeg"]; // 06. the image set at the maximum value of the slider bar. The default value is nil slider. maximumValueImage = [UIImage imageNamed: @ "001.jpeg"]; // 07. minimumTrackTintColor: The color of the slider bar smaller than the current value of the slider. The default value is blue slider. minimumTrackTintColor = [UIColor redColor]; // 08. maximumTrackTintColor: The color of the slider bar greater than the current value of the slider. The default value is white slider. maximumTrackTintColor = [UIColor blueColor]; // 09. thumbTintColor: The color of the current slider. The default value is white slider. thumbTintColor = [UIColor yellowColor]; // 10. currentMaximumTrackImage: The image set at the maximum value of the slider bar // 11. currentMinimumTrackImage: The image set at the minimum value of the slider bar // 12. currentThumbImage: the image of the current slider [slider addTarget: self action: @ selector (sliderValueChanged :) forControlEvents: UIControlEventValueChanged];
-(void)sliderValueChanged:(UISlider *)slider{ NSLog(@"slider value%f",slider.value);}