iphone - UISlider with different colors -
i have slider min value 0 , max value 5(be value) , need display 5 different colors in same slider ie 0-1 1 color, 1-2 color , on. possible . please me if idea.
try this,
uislider *slider = [[uislider alloc] initwithframe:cgrectmake(0.0f, 400.0f, 320.0f, 35.0f)]; [slider setminimumtracktintcolor:[uicolor redcolor]]; // initial color of selection [slider addtarget:self action:@selector(slidervaluechanged:) forcontrolevents:uicontroleventvaluechanged]; [[self view] addsubview:slider];
in target method, can set colors
- (void)slidervaluechanged:(uislider *)slider { /* here check value of slider [slider value] call; set color of slider using [slider setminimumtracktintcolor:[uicolor redcolor]]; */ }
hope :)
Comments
Post a Comment