UISlider, UISlider
Directly run the Code:
/* UISlider */UISlider * slider = [[UISlider alloc] initWithFrame: CGRectMake (30,300, CGRectGetWidth (self. view. bounds)-60, 30)]; // you can specify the minimum slider of the slider. minimumValue = 0; // set the maximum slider of the slider. maximumValue = 100; // sets the current value of the slider. The default value is the minimum value (the current value indicates the position of the slider) slider. value = 20; // set the trackTintColor slider of the slider. minimumTrackTintColor = [UIColor blueColor]; slider. maximumTrackTintColor = [UIColor brownColor]; // sets the track icon s. Lider. minimumValueImage = [UIImage imageNamed: @ "2"]; slider. maximumValueImage = [UIImage imageNamed: @ "4"]; // you can set an image for the slider to modify the appearance. [slider setThumbImage: [UIImage imageNamed: @ "2"] forState: UIControlStateNormal]; [slider setThumbImage: [UIImage imageNamed: @ "4"] forState: Unknown]; [slider addTarget: self action: @ selector (handleSliderAction :) forControlEvents: UIControlEventValueChanged]; [se Lf. view addSubview: slider]; [slider release];}-(void) handleSliderAction :( UISlider *) sender {// a series of values are generated when the slider slides, you can get the current value through the response method and implement it accordingly. Typical scenarios of Slide include volume, music progress, video progress, screen progress, and so on. NSLog (@ "% f", sender. value );}
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.