Skip to content
Customizable wheel picker view implementation for iOS.
Branch: master
Clone or download
Latest commit d161b05 Sep 18, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Example
WheelPicker
.gitignore
.travis.yml
CHANGELOG.md
LICENSE
README.md
WheelPicker.podspec
_Pods.xcodeproj initial commit Apr 11, 2017
logo.png
mov1.gif
mov2.gif initial commit Apr 11, 2017

README.md

WheelPicker

Version Swift 4.2.x

TheMindStudios

A simple yet customizable horizontal and vertical picker view

Features

  • Vertical or Horizontal picker
  • Image or Text data
  • Configure UILabel & UIImageView
  • Flat & 3D style
  • Custom mask
  • Configure fisheye factor

Example Example

Usage

  1. Import WheelPicker module to your ViewController class
import WheelPicker
  1. Instantiate and set delegate and dataSource as you know. Configure WheelPicker if need
picker.dataSource = self
picker.delegate = self

2.1. Configure WheelPicker if need

picker.interitemSpacing = 25.0
picker.fisheyeFactor = 0.001
picker.style = .style3D
picker.isMaskDisabled = false
picker.scrollDirection = .vertical

picker.textColor = UIColor.blue.withAlphaComponent(0.5)
picker.highlightedTextColor = UIColor.blue
  1. then specify the number of items using WheelPicker methods
func numberOfItems(_ wheelPicker: WheelPicker) -> Int
  1. Specify contents to be shown. You can use either texts or images
optional func titleFor(_ wheelPicker: WheelPicker, _ index: Int) -> String
optional func imageFor(_ wheelPicker: WheelPicker, _ index: Int) -> UIImage
func wheelPicker(_ wheelPicker: WheelPicker, configureLabel label: UILabel, at index: Int) {
   
   label.textColor = UIColor.black.withAlphaComponent(0.5)
   label.highlightedTextColor = UIColor.black
   label.backgroundColor = UIColor.init(hue: CGFloat(index)/CGFloat(flags.count) , saturation: 1.0, brightness: 1.0, alpha: 1.0)
}
  • Using both texts and images are currently not supported. When you implement both, titleFor(_ wheelPicker: WheelPicker, at index: Int) will be called and the other won't.
  • You currently cannot specify image sizes; WheelPicker shows the original image in its original size. Resize your images in advance if you need.
  1. Optional: You can use WheelPicker method to observe selection changes
func wheelPicker(_ wheelPicker: WheelPicker, didSelectItemAt index: Int)

Installation with CocoaPods

To install via CocoaPods add this lines to your Podfile. You need CocoaPods v. 1.1.0 or higher

$ gem install cocoapods

Podfile

To integrate WheelPicker into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!

target 'TargetName' do
  pod 'WheelPicker', '~> 1.0'
end

Then, run the following command:

$ pod install

License

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

You can’t perform that action at this time.