RangeSeekSlider icon indicating copy to clipboard operation
RangeSeekSlider copied to clipboard

Feature Request : adding positive suffix to just selectedMaxValue

Open chitvan832 opened this issue 8 years ago • 1 comments

I have a salary range from 0 to 10000, I want when the user selects 10,000 (maxValue) then the label should show "10,000+"

chitvan832 avatar Jul 19 '17 07:07 chitvan832

I have do like this RangeSeekSlider.swift

private func updateLabelValues() { minLabel.isHidden = hideLabels || disableRange maxLabel.isHidden = hideLabels

    if let replacedString = delegate?.rangeSeekSlider(self, stringForMinValue: selectedMinValue) {
        minLabel.string = replacedString
    } else {
        minLabel.string = numberFormatter.string(from: selectedMinValue as NSNumber)
    }

    if let replacedString = delegate?.rangeSeekSlider(self, stringForMaxValue: selectedMaxValue)
    {
        maxLabel.string = replacedString
    }
    else
    {
        if selectedMaxValue >= maxValue
        {
             maxLabel.string = numberFormatter.string(from: selectedMaxValue as NSNumber)! + "+"
        }
        else
        {
             maxLabel.string = numberFormatter.string(from: selectedMaxValue as NSNumber)
        }
    }

    if let nsstring = minLabel.string as? NSString {
        minLabelTextSize = nsstring.size(attributes: [NSFontAttributeName: minLabelFont])
    }

    if let nsstring = maxLabel.string as? NSString {
        maxLabelTextSize = nsstring.size(attributes: [NSFontAttributeName: maxLabelFont])
    }
}

MaxJadav avatar Aug 15 '17 07:08 MaxJadav