customizing Styles and sliders for UISlider
// track pictures
UIImage *stetchlefttrack = [UIImageimagenamed:@ "thick"];
UIImage *stetchrighttrack = [UIImageimagenamed:@ "thick"];
// slider picture
UIImage *thumbimage = [UIImageimagenamed:@ "thumb"];
// Create Slider
uislider *slider = [[uislideralloc] initwithframe:cgrectmake(30 , 7) ];
Slider. BackgroundColor = [uicolorclearcolor];
Slider. Value =1.0;
Slider. MinimumValue =0.5;
Slider. MaximumValue =1.0;
// Set the picture of the track
[Slider setminimumtrackimage: Stetchlefttrackforstate:uicontrolstatenormal];
[Slider setmaximumtrackimage: Stetchrighttrackforstate:uicontrolstatenormal];
// Set the picture of the slider
//[slider setthumbimage:thumbimage forstate:uicontrolstatehighlighted];
[Slider setthumbimage: Thumbimageforstate:uicontrolstatenormal];
// slide slider to add events
// sliding events in the process of continuous triggering
[Slider addTarget:self action:@selector(onthumb:) forControlEvents:uicontroleventvaluechanged];
// swipe to finish adding events
// The event is triggered when the slide is complete
[Slider addTarget:self action:@selector(endthumb:) forcontrolevents:uicontroleventtouchupinside];
[selfaddsubview: slider];
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
customizing styles and sliders for UISlider