Latest 1.1.1
Homepage https://github.com/zhiquan911/CHRangeSlider
License MIT
Platforms ios 8.0
Authors

CI Status
Version
License
Platform

Swift3编写的多点滑杆组件,支持一条滑杆,多个滑块滑动操纵

demo1.jpg

Features

  • Swift3.0编写
  • 支持在滑杆上无限添加滑块点
  • 提供滑块上下文本标签内容修改
  • 可通过IB修改滑杆颜色,高度,边距等等
  • 可自定滑块颜色,图标,大小,文字格式等等
  • 滑动流畅,数值准确

Example


@IBOutlet var rangeSlider: CHRangeSlider!

override func viewDidLoad() {
    super.viewDidLoad()
    rangeSlider.minValue = 4500
    rangeSlider.maxValue = 5500

    rangeSlider.delegate = self
    let minSelectItem = CHSliderHandler()
    minSelectItem.bottomText = "委托价"
    minSelectItem.value = 4600
    minSelectItem.handlerColor = UIColor.red

    let midSelectItem = CHSliderHandler()
    midSelectItem.bottomText = "当前价"
    midSelectItem.value = 5000
    midSelectItem.handlerColor = self.rangeSlider.tintColor

    let maxSelectItem = CHSliderHandler()
    maxSelectItem.bottomText = "触发价"
    maxSelectItem.value = 5300
    maxSelectItem.handlerColor = UIColor.white
    maxSelectItem.borderColor = self.rangeSlider.tintColor
    maxSelectItem.isSolid = false
    self.rangeSlider.handlers = [minSelectItem, midSelectItem, maxSelectItem]
}

// MARK: - 实现滑杆委托方法
extension ViewController: CHRangeSliderDelegate {

    func rangeSlider(slider: CHRangeSlider, stringForValue value: Double, handler: CHSliderHandler) -> String {
        let text = String(format: "¥%.2f", value)
        if handler === self.minSelectItem {
            self.textFieldOrder.text = String(format: "%.2f", value)
        } else if handler === self.midSelectItem {
            self.textFieldCurrent.text = String(format: "%.2f", value)
        } else if handler === self.maxSelectItem {
            self.textFieldTrigger.text = String(format: "%.2f", value)
        }
        return text
    }
}

Requirements

  • iOS 8+
  • Xcode 8+
  • Swift 3.0+
  • iPhone/iPad

Installation

CHRangeSlider is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "CHRangeSlider"

Author

Chance, [email protected]

Donations

为了让开发者更积极分享技术,开源程序代码,我们发起数字货币捐助计划,捐款只接收以下货币。

  • BTC Address: 3G4NdQQyCJK1RS5URb4h5KogWEyR4Mk16A

License

CHRangeSlider is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "CHRangeSlider",
    "version": "1.1.1",
    "summary": "Swift3u7f16u5199u7684u591au70b9u6ed1u6746u7ec4u4ef6",
    "description": "Swift3u7f16u5199u7684u591au70b9u6ed1u6746u7ec4u4ef6uff0cu652fu6301u4e00u6761u6ed1u6746uff0cu591au4e2au6ed1u5757u6ed1u52a8u64cdu7eb5",
    "homepage": "https://github.com/zhiquan911/CHRangeSlider",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Chance": "[email protected]"
    },
    "source": {
        "git": "https://github.com/zhiquan911/CHRangeSlider.git",
        "tag": "1.1.1"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "CHRangeSlider/Classes/**/*",
    "pushed_with_swift_version": "4.0"
}

Pin It on Pinterest

Share This