Update format of the minLabel & maxLabel
Hello there, I would like to format the slider text (minimum label & maximum label) that are there on the left & right side.
Let me explain scenario.
I am making flight app where I am using this slider I have filter where I need to select the duration I have duration as 245 to 510 means 4 hrs 5 min to 8 hr 30 min. What I want to do is show 4 hrs 5 min instead of 245. Any idea how this customization can be done? I can handle the logic, however I am unable to find a place where I can set text. I have a function ready which will convert integer (245) to string (4 hrs 5 min).
Thank you.
I found a solution.
I set tag as 99 for the hour slider and update below in updateLabelValues.
if let replacedString = delegate?.rangeSeekSlider(self, stringForMinValue: selectedMinValue) {
minLabel.string = replacedString
} else {
if (self.tag==99) {
minLabel.string = "\(GlobalFunctions.minutesToHoursMinutes(minutes: Int(selectedMinValue)).hours)\("hourShort".localized()) \(GlobalFunctions.minutesToHoursMinutes(minutes: Int(selectedMinValue)).leftMinutes)\("minutesShort".localized())"
} else {
minLabel.string = numberFormatter.string(from: selectedMinValue as NSNumber)
}
}
if let replacedString = delegate?.rangeSeekSlider(self, stringForMaxValue: selectedMaxValue) {
maxLabel.string = replacedString
} else {
if (self.tag==99) {
maxLabel.string = "\(GlobalFunctions.minutesToHoursMinutes(minutes: Int(selectedMaxValue)).hours)\("hourShort".localized()) \(GlobalFunctions.minutesToHoursMinutes(minutes: Int(selectedMaxValue)).leftMinutes)\("minutesShort".localized())"
} else {
maxLabel.string = numberFormatter.string(from: selectedMaxValue as NSNumber)
}
}