How to create currency range slider in iOS
When you want to show the currency you selected by the minimum and maximum value of currency that can vary when user selects the currency . It can’t be possible to show the minimum and maximum value using the UISlider in iOS. So to show the currency that varies , You can use the TTRangeslider Library download from (https://github.com/TomThorpe/TTRangeSlider). You can also show the currency according to your country selected in your iPhone. It will automatically pick the currency . How to use :-
1. Firstly, You can download the library.
2. Then drag and drop these classes into your project (TTRangeSliderDelegate.h , TTRangeSlider.h , TTRangeSlider.m).
3. Insert the following code.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
let rangeSliderCurrency = TTRangeSlider(frame: CGRect(x: CGFloat(SCREEN_WIDTH/2.5 + 10), y: CGFloat(100), width: CGFloat((SCREEN_WIDTH - SCREEN_WIDTH/2.5))-20, height: CGFloat(10.0))) rangeSliderCurrency.tag = 156 rangeSliderCurrency.minValue = 0 rangeSliderCurrency.maxValue = 150 rangeSliderCurrency.selectedMinimum = 0 rangeSliderCurrency.selectedMaximum = 150 rangeSliderCurrency.handleColor = UIColor.green rangeSliderCurrency.handleDiameter = 30 rangeSliderCurrency.selectedHandleDiameterMultiplier = 1.3 let formatter = NumberFormatter() formatter.numberStyle = .currency rangeSliderCurrency.numberFormatterOverride = formatter self.view.addSubview(rangeSliderCurrency) |