Custom UISlider iPhone will look like volume control iPod app

So, I have a UISlider that I configure 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 shown in the iPod app (which AFAIK you can't do in code). Since I use high-resolution images, it attracts an entire huge application, for example: enter image description here

Actually desired effect: enter image description here

If I reduce the actual images, I will lose quality and it looks garbage and blurry! So I'm looking to do this in code, but a little lost ...

+4
source share
1 answer

Are high resolution images for retina playback iPhone? If so, you should use the names slider_blue@2x.png for the high resolution image and slider_blue.png for the regular res image. Image @ 2x (suprise), twice as much.

Then the SDK will use the correct one based on the device.

+5
source

Source: https://habr.com/ru/post/1343802/


All Articles