Skip to main content

Align UISlider thumb image - objective-c



I've customized my UISlider but my thumb image looks strange, I mean it's position not aligned by center:





enter image description here





But should be like this:





enter image description here





And here is code:







UIImage *leftTrack = [[UIImage imageNamed:@"blueTrack.png"] stretchableImageWithLeftCapWidth:3 topCapHeight:0];

UIImage *rightTrack = [[UIImage imageNamed:@"whiteTrack.png"] stretchableImageWithLeftCapWidth:3 topCapHeight:0];

[slider setThumbImage:[UIImage imageNamed:@"thumbButton.png"] forState:UIControlStateNormal];

[slider setMinimumTrackImage:leftTrack forState:UIControlStateNormal];

[slider setMaximumTrackImage:rightTrack forState:UIControlStateNormal];







Where could be the problem?





EDIT: I found solution of this problem. Thumb image background was transparent, and I've not seen that thumb image was not aligned by center:





enter image description here


Comments

Popular posts from this blog

Slow Android emulator

I have a 2.67 GHz Celeron processor, 1.21 GB of RAM on a x86 Windows XP Professional machine. My understanding is that the Android emulator should start fairly quickly on such a machine, but for me it does not. I have followed all instructions in setting up the IDE, SDKs, JDKs and such and have had some success in staring the emulator quickly but is very particulary. How can I, if possible, fix this problem?