欢迎光临
我们一直在努力

【Swift】CircularSlider

建站超值云服务器,限时71元/月

【Swift】CircularSlider

项目介绍:

CircularSlider

用Swift写的圆形滑杆(Slider)。100%使用IBDesignable,所用属性参数可IBInspectable。

Demo

Slider demo

Installation

支持cocoapods,只需要在podfile文件中添加以下关键字:

Swift 3:

pod 'CircularSlider'

Swift 2.2:

pod 'CircularSlider' ', '~> 0.2'

Usage

You can use this slider by declaring programmatically or by placing it in your Storyboard file.
All the paramters are IBInspectable, so you can configure the slider directly in the Storyboard file (in the attribute inspector tab) without write any line of code!

1
2

Delegate

Optionally you can conforms to the methods of the CircularSliderDelegate protocol.

If you want to admit only certain values you can implement this methods:

optional func circularSlider(circularSlider: CircularSlider, valueForValue value: Float) -> Float

With this method you override the actual slider value before the slider is updated.
Example: you want only rounded values:

func circularSlider(circularSlider: CircularSlider, valueForValue value: Float) -> Float {
return floorf(value)
}

The other methods you can implement are:

optional func circularSlider(circularSlider: CircularSlider, didBeginEditing textfield: UITextField)
optional func circularSlider(circularSlider: CircularSlider, didEndEditing textfield: UITextField)

Author

taglia3, matteo.tagliafico@gmail.com

LinkedIn, Matteo Tagliafico

code4app

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 【Swift】CircularSlider
分享到: 更多 (0)