Latest 0.1
Homepage https://github.com/xiekunRonaldo/YMDPickerView
License MIT
Platforms ios 6.0, requires ARC
Authors

custom datePicker view, without showing the past year and future year

Thanks rolandleth,This Library is inspired by his great libraryLTHMonthYearPickerView

Apple Provides us the UIDatePickerView to selecte Date,but sometimes we want only to show the years between minimum Date and maximum Date,This Control comes to help!

First See the effect

Demo

How to use

First , you need to set the beginDate and endDate to limit the date to shown, just like the UIDatePickerView’s minumum Date and maximum Date

NSDate *beginDate = [NSDate date];

NSDate *endDate = [[NSDate date] dateByAddingDays:365];

YMDPickerView *datePicker = [[YMDPickerView alloc] initWithBeginDate:beginDate endDate:endDate
                                      shortMonths: NO
                                   numberedMonths: YES
                                       andToolbar: NO];

[self.view addSubView:datePicker];

after you select Date,you can get the date by datePicker.date, or if you want to see the date every time the date picker stop scrolling, you can achieve it by implementing the delegate methods

datePicker.delegate = self; 

delegate Method
- (void)pickerDidSelectDate:(NSDate *)date{

}

Latest podspec

{
    "name": "YMDPickerView",
    "version": "0.1",
    "summary": "Custom DatePickerView, only show the selected Date years",
    "homepage": "https://github.com/xiekunRonaldo/YMDPickerView",
    "license": "MIT",
    "authors": {
        "allenToFight": "[email protected]"
    },
    "platforms": {
        "ios": "6.0"
    },
    "source": {
        "git": "[email protected]:xiekunRonaldo/YMDPickerView.git",
        "tag": "0.1"
    },
    "source_files": [
        "YMDPickerView",
        "YMDPickerView/*.{h,m}"
    ],
    "requires_arc": true
}

Pin It on Pinterest

Share This