Custom iPhone UISlider to look like the iPod app volume control
So I have a UISlider
which I'm customizing with some images:
UIImage *stetchLeftTrack = [[UIImage imageNamed:@"slider_blue.png"] stretchableImageWithLeftCapWidth:9.0 topCapHeight:0.0];
UIImage *stetchRightTrack = [[UIImage imageNamed:@"slider_white.png"] stretchableImageWithLeftCapWidth:9.0 topCapHeight:0.0];
[volumeSlider setThumbImage: [UIImage imageNamed:@"slider_blob.png"] forState:UIControlStateNormal];
[volumeSlider setMinimumTrackImage:stetchLeftTrack forState:UIControlStateNormal];
[volumeSlider setMaximumTrackImage:stetchRightTrack forState:UIControlStateNormal];
I'm actually just trying to copy the volume controls as seen in the iPod app (which AFAIK you can't do in code). Because I'm using high res images, it draws everything h开发者_如何转开发uge on the app like so:
When actually the desired effect is:
If I scale down the actual images, I lose the quality and it looks rubbish and blurry! So I'm looking to do this in code but got a bit lost...
Are the high res images for the iPhone retina desplay? If so, you should use the names slider_blue@2x.png
for the high res image and slider_blue.png
for a normal res image. The @2x image is (suprise), twice the size.
The SDK will then use the correct one based on the device.
精彩评论