Latest 0.0.1
Homepage https://github.com/hell03W/WHRuler
License MIT (SweetRuler)
Platforms ios 8.0
Authors

WHRuler

效果图如下所示:

简单的使用方法如下所示, 首先创建, 然后做简单的配置, 遵循代理, 从代理中可以拿到刻度尺变化的值.

// delegate
func configUI() {

let sweetRuler = SweetRuler(frame: CGRect(x: 10, y: 100, width: 300, height: 40))
view.addSubview(sweetRuler)
sweetRuler.figureRange = Range(uncheckedBounds: (500, 30000))
sweetRuler.setSelectFigure(figure: 18000)
sweetRuler.delegate = self
}

///刻度尺代理方法
func sweetRuler(ruler: SweetRuler, figure: Int){

print("ttfigure: (figure)")
}

可配置的选项如下所示:

/// 刻度尺表示的范围
var figureRange = Range(uncheckedBounds: (1000,10000))
/// 尺子的长度
var rulerLength: Double = 300
/// 刻度的宽度, 刻度之间的间隔
var dialBlank: Double = 10.0
/// 刻度分割最小的高度
var dialMinHeight: Double = 8
/// 刻度分割最大的高度
var dialMaxHeight: Double = 13
/// 刻度的颜色
var dialColor: UIColor = UIColor.gray
/// 每个刻度表示的宽度
var dialSpan: Int = 100
/// 文字颜色
var textColor: UIColor = UIColor.lightGray

Latest podspec

{
    "name": "SweetRuler",
    "version": "0.0.1",
    "summary": "A slide ruler use to select some numbers, support Integer, Double. Write by swift-3.0.",
    "description": "A slide ruler use to select some numbers, support Integer, Double. Write by swift-3.0. I hope this will give someone convenience.",
    "homepage": "https://github.com/hell03W/WHRuler",
    "license": "MIT (SweetRuler)",
    "authors": {
        "weidf": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/hell03W/WHRuler.git",
        "commit": "5bbfd170f8cac72a4b4c86432b161f9905406e3c"
    },
    "source_files": [
        "WHRuler",
        "WHRuler/WHRuler/*.*"
    ],
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This