Open JyotsnaPiOSDEV opened 2 years ago
I tried to add image then it goes down from slider internal func setupLayers() { trackLayer.addSublayer(thumbLayer) trackLayer.addSublayer(outlineLayer) let uiview1 = UIView() let uiview2 = UIView() uiview1.frame = CGRect(x: 5, y: 0, width: thumbLayer.frame.width - 10 , height: 98) uiview2.frame = CGRect(x: 5, y: 0, width: 44 , height: 44) let appLightGrayColor = UIColor(red: 201.0/255.0, green: 201.0/255.0, blue: 201.0/255.0, alpha: 1.0) uiview1.backgroundColor = appLightGrayColor uiview1.layer.cornerRadius = 10 // uiview1.addSubview(uiview2) // uiview2.center = uiview1.center // uiview2.frame = uiview1.frame uiview2.center = uiview1.center uiview2.layer.contents = UIImage(named: "power-signal-white")?.cgImage uiview2.layer.contentsGravity = CALayerContentsGravity.resizeAspect // uiview1.center = uiview1.center // uiview1.addSubview(uiview2) uiview1.layer.addSublayer(uiview2.layer) thumbLayer.addSublayer(uiview1.layer)
thumbLayer.addSublayer(thumbOutlineLayer) }
Check this pull request: #12
I tried to add image then it goes down from slider internal func setupLayers() { trackLayer.addSublayer(thumbLayer) trackLayer.addSublayer(outlineLayer) let uiview1 = UIView() let uiview2 = UIView() uiview1.frame = CGRect(x: 5, y: 0, width: thumbLayer.frame.width - 10 , height: 98) uiview2.frame = CGRect(x: 5, y: 0, width: 44 , height: 44) let appLightGrayColor = UIColor(red: 201.0/255.0, green: 201.0/255.0, blue: 201.0/255.0, alpha: 1.0) uiview1.backgroundColor = appLightGrayColor uiview1.layer.cornerRadius = 10 // uiview1.addSubview(uiview2) // uiview2.center = uiview1.center // uiview2.frame = uiview1.frame uiview2.center = uiview1.center uiview2.layer.contents = UIImage(named: "power-signal-white")?.cgImage uiview2.layer.contentsGravity = CALayerContentsGravity.resizeAspect // uiview1.center = uiview1.center // uiview1.addSubview(uiview2) uiview1.layer.addSublayer(uiview2.layer) thumbLayer.addSublayer(uiview1.layer)