Yanyinghenmei / ZYCalendarView

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ZYCalendarView

image

参考JTCalendar, 模仿Airbnb的日历

Reference JTCalendar, imitate Airbnb's calendar

How to use

Download ZYCalendarView and try out the included you iPhone project or use CocoaPods.

Podfile

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

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'

target 'TargetName' do
pod 'ZYCalendarView', '~> 0.0.2'
end

Then, run the following command:

$ pod install

Simple code

#import <ZYCalendarView.h>
    ZYCalendarView *view = [[ZYCalendarView alloc] initWithFrame:CGRectMake
                           (0, 64, self.view.frame.size.width, self.view.frame.size.height-64)];
    
    // 不可以点击已经过去的日期
    view.manager.canSelectPastDays = false;
    // 可以选择时间段
    view.manager.selectionType = ZYCalendarSelectionTypeRange;
    // 设置当前日期
    view.date = [NSDate date];
    
    view.dayViewBlock = ^(ZYCalendarManager *manager, NSDate *dayDate) {
        // NSLog(@"%@", dayDate);
        for (NSDate *date in manager.selectedDateArray) {
            NSLog(@"%@", [manager.dateFormatter stringFromDate:date]);
        }
        printf("\n");
    };

About

License:MIT License


Languages

Language:Objective-C 87.2%Language:Ruby 12.8%