- iPhone Dev A better UISlider | Cactus

A better UISlider

Just a code Snippet and three files to improve the (broken/too small/impossible to catch) UISlider from Apple.

CGRect rect = CGRectMake (16.0, 262.0, 284.0, 35.0); //last size of cgrect is important : thumb is 34 pixels high\ accuracySlider.frame = rect;\ UIImage* thumbImage = [UIImage imageNamed:@"thumb.png"];\ [accuracySlider setThumbImage:thumbImage forState:UIControlStateNormal];\ UIImage* leftImage = [UIImage imageNamed:@"left.png"];\ [leftImage stretchableImageWithLeftCapWidth:5 topCapHeight:0];\ [accuracySlider setMinimumTrackImage:leftImage forState:UIControlStateNormal];\ UIImage* rightImage = [UIImage imageNamed:@"right.png"];\ [rightImage stretchableImageWithLeftCapWidth:5.0 topCapHeight:9.0];\ [accuracySlider setMaximumTrackImage:rightImage forState:UIControlStateNormal];\

And the images:

image image image

Bigger ah?

Publié le 20 Jan 2009
Écrit par Cyril Godefroy