ios - set UIslider thumb image in swift -


i want set thumb of musi app here ss

i want

enter image description here

i have

enter image description here

here code

        durationslider.setthumbimage(uiimage(named: "slider_indicator.png"), forstate: uicontrolstate.normal)     durationslider.setthumbimage(uiimage(named: "slider_indicator.png"), forstate: uicontrolstate.highlighted) 

if want clip top part of thumbimage, should use:

public func thumbrectforbounds(bounds: cgrect, trackrect rect: cgrect, value: float) -> cgrect 

so add code:

durationslider.thumbrectforbounds(...) 

and set cgrect of thumbrect have value of durationslider.frame.origin.y own origin.y.

here's temporary solution, i'll thumbrectforbounds method shortly:

let mask = cagradientlayer(layer: durationslider.layer) let linetop = (durationslider.bounds.height/2 - 0.5) / durationslider.bounds.height mask.frame = durationslider.bounds mask.colors = [uicolor.clearcolor().cgcolor, uicolor.blackcolor().cgcolor] mask.locations = [linetop, linetop] durationslider.layer.mask = mask 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -