ios - set UIslider thumb image in swift -
i want set thumb of musi app here ss
i want
i have
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
Post a Comment