How can UISlider change its appearance when disabled?

I'm working on a custom slider custom element and in at least some respects I'd like to emulate as closely as possible UISlider

. Right now I am looking at the behavior UISlider

when its property enabled

- inherited from UIControl

- is set to false. enabled

, the UIControl

documentation
says:

Indicate YES to enable control; otherwise, specify NO to disable it. The default is YES. If the on state is NO, the control ignores touch events and subclasses can draw differently.

And of course it UISlider

draws differently if not enabled:

UISlider enabled
Included

UISlider disabled
Disabled

I would like to know exactly what it is doing UISlider

in order to paint myself in this "faded" way, so I can copy it.

My first instinct was that he was just decreasing his alpha, which would be very easy to emulate. However, upon closer inspection of the images, I realized that alpha cannot explain the whole effect:

UISlider enabled, zoomed
Included, increased

UISlider disabled, zoomed
Disabled, increased

Looking at these two images there seems to be some kind of blurring. This is especially noticeable in the blue minimum track image, which is a solid color in the zoomed, turned on image, but has an obvious vertical gradient in the zoomed, turned off image.

What UISlider

to do?

+3


source to share





All Articles