Closed AaoIi closed 4 years ago
Description of the problem: I have a slider with two thumbs but i tried to set both properties and both of them are not taking effect, so they are still overlapping.
timeSlider.keepsDistanceBetweenThumbs = true timeSlider.distanceBetweenThumbs = 50
Snap of my code :
timeSlider = MultiSlider() timeSlider.frame = CGRect.init(x: 16, y: 0, width: UIScreen.main.bounds.width - 32, height: timeSliderContainer.frame.height) timeSlider.minimumValue = 00.00 // default is 0.0 timeSlider.maximumValue = 23.5 // default is 1.0 timeSlider.snapStepSize = 0.5 timeSlider.value = [00.00, 23.5] timeSlider.thumbCount = 2 timeSlider.outerTrackColor = AppConstants.Colors.General.cayan // outside of first and last thumbs timeSlider.orientation = .horizontal // default is .vertical timeSlider.tintColor = AppConstants.Colors.General.darkGray // color of track timeSlider.trackWidth = 6 timeSlider.hasRoundTrackEnds = true timeSlider.valueLabelPosition = .top timeSlider?.showsThumbImageShadow = true timeSlider.keepsDistanceBetweenThumbs = true timeSlider.distanceBetweenThumbs = 50 timeSlider.addTarget(self, action: #selector(sliderChanged(slider:)), for: .valueChanged) // continuous changes timeSlider.addTarget(self, action: #selector(sliderDragEnded(slider:)), for: . touchUpInside) // sent when drag ends timeSliderContainer.addSubview(timeSlider) // timeSliderContainer.addConstrainedSubview(timeSlider!, constrain: .leftMargin, .rightMargin, .bottomMargin) // timeSliderContainer.layoutMargins = UIEdgeInsets(top: 0, left: 32, bottom: 0, right: 32) timeSlider.thumbViews[0].image = UIImage(named: "min_time_icon") timeSlider.thumbViews[1].image = UIImage(named: "max_time_icon") timeSliderContainer.subviews.first?.removeFromSuperview()
Fixed in 1.10.11.
Note that distanceBetweenThumbs needs to be smaller than maximumValue - minimumValue.
distanceBetweenThumbs
maximumValue - minimumValue
Description of the problem: I have a slider with two thumbs but i tried to set both properties and both of them are not taking effect, so they are still overlapping.
Snap of my code :