Skip to content
Custom picker view inspired by Rise (http://rise.simplebots.co) and Timely (https://timelyapp.com) apps
Swift Ruby
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Example
Pod
.gitignore
.swift-version
.travis.yml
LICENSE
PannablePickerView.podspec
README.md
_Pods.xcodeproj

README.md

PannablePickerView

Version License Platform

PannablePickerView lets the user select a numeric value moving its finger up and down inside the control.

Built as a better way of handling value selection from a finite range (than UISlider and other alternatives), you can embed it to a full screen app, inline on a TableView or as a UITextField's inputView substitution! (read: awesome in-app custom keyboard). Check out the example project for more.

Customizable, you can change sizes, colors, units, prefix/suffix and more.

What's new on 2.0:

  • Swif 4.0 support

Installation

pod "PannablePickerView"
  • Manually:
  1. Clone this repo or download it as a .zip file
  2. Drag and drop PannablePickerView.swift to your project

Usage

  • From Storyboard:
  1. Drag and drop and UIView and name its Custom Class property as "PannablePickerView".
  2. Asign an IBAction to its "Value Changed" control event.
  • Programatically:
  1. Create an instance of it and add it to a view.
  2. You can either asign a frame to it or create NSLayoutConstraints.
  3. Add a selector for its .ValueChanged control event.

Properties

Thanks to @IBInspectables, you can customize its properties right on Storyboard:

You can also always do it programatically, of course.

@IBInspectable public var continuous:Bool = false

Determines wether the picker's value moves continuously or in discrete steps. Default value is false.

@IBInspectable public var value:Double

Current selected value. Affected by 'continuous', it could be a decimal number. This is the property you should pay attention to at 'Value Changed' control event. Default value is 0.

@IBInspectable public var minValue:Double = 0

Minimun value. Default value is 0

@IBInspectable public var maxValue:Double = 100

Maximun value. Default value is 100

@IBInspectable public var minLabelSize:CGFloat = 30.0

Minimum font size for shown value at panning. Default value is 30

@IBInspectable public var maxLabelSize:CGFloat = 54.0

Maximum font size for shown value at the center. Default value is 54

@IBInspectable public var textColor:UIColor = UIColor.whiteColor()

Text color for presented value. Default value is white

@IBInspectable public var textPrefix:String = ""

Prefix for shown value. Default value is ""

@IBInspectable public var textSuffix:String = ""

Suffix for shown value. Default value is ""

@IBInspectable public var unit:String = ""

Unit presented below shown value. Default is ""

@IBInspectable public var unitColor:UIColor = UIColor.whiteColor()

Text color for unit. Default is white

@IBInspectable public var unitSize:CGFloat = 14.0

Font size for unit. Default is 14

Delegate methods

optional func pannablePickerViewDidBeginPanning(sender:PannablePickerView)

Triggered when user has began interacting with the control

optional func pannablePickerViewDidEndPanning(sender:PannablePickerView)

Triggered when users has ended interacting with the control

Requirements

  • iOS 9.0 or later
  • Xcode 9.0 or later (Uses Swift 4.0 syntax)

Author

Diego Cruz, diego.cruz@icloud.com

License

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

You can’t perform that action at this time.