Ysix / MonthYearPicker

A UIDatePicker subclass for selecting a date using a month and a year

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MonthYearPicker

Version License Platform

This is a UIDatePicker subclass that allows date selection using month / year. It is locale-aware and shows localised values.

Screenshot

Usage

Initialise the picker just like you would UIPickerView. You can set a closure to execute when the date changes using the dateSelectionHandler property.

let picker = MonthYearPickerView(frame: CGRect(origin: CGPoint(x: 0, y: (CGRectGetHeight(view.bounds) - 216) / 2), size: CGSize(width: CGRectGetWidth(view.bounds), height: 216)))
picker.dateSelectionHandler = { date in
  print("selected: \(date)")
}
self.view.addSubview(picker)

Requirements

iOS 8.0 or later

Installation

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

pod "MonthYearPicker"

Author

Alexander Edge, alex@alexedge.co.uk

License

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

About

A UIDatePicker subclass for selecting a date using a month and a year

License:MIT License


Languages

Language:Shell 52.3%Language:Swift 39.0%Language:Ruby 5.6%Language:Objective-C 3.0%