IOS UISlider and iOSUISlider

Source: Internet
Author: User

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);}

 

 

 

 

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.