Quote:
Originally Posted by mycatsnameisbernie
After spending way too much time on this, I finally have some code that I am happy with. I solved the two problems from my previous post as follows:
- I added the full image of the track as a UIImageView instead of making it the UISlider's background image. This avoids the "squishing" of the edges of the track as the slider moves. It also allows the UISlider to be smaller than the track, so there is no longer a need to add transparent padding to the thumb image.
- I implemented the "shimmering" text animation using the method in this post.
You can download an XCode project containing my code here.
There are 2 issues that could use improvement if anyone else wants to try...
- The text animation is done using a repeating NSTimer to programatically shift the text highlighting. I would have preferred to have the iPhone's graphics engine perform the animation. I couldn't figure out how to do this with Core Animation on the iPhone. I think it could be done with CA on OS X using CALayer mask layers, but mask layers are not supported on iPhone OS. It might be possible with OpenGL, but I don't have any expertise in that area.
- The text rendering code only supports Roman alphabets. In order to support Asian or other non-Roman alphabets, the text drawing code needs to be modified to use glyphs instead of characters.
Hope this helps...
|
Thanks for putting the effort in to make a working project so we can see it in action. I'm using the control in a project I'm writing and I've noticed that you have to hold the thumb image before it will start sliding.
Has anyone else noticed this? Is it just me, the standard Unlock picks up your finger movement straight away?