Skip to content

Latest commit

 

History

History
18 lines (18 loc) · 887 Bytes

README.md

File metadata and controls

18 lines (18 loc) · 887 Bytes

image

示例代码

ZBCalendarCollectionView*collection = [[ZBCalendarCollectionView alloc]initWithFrame:CGRectMake(0, 100, CGRectGetWidth(self.view.frame), 80)];
    collection.selectedBlock = ^(NSDate* date){
        NSDateFormatter *year = [[NSDateFormatter alloc]init];
        [year setDateFormat:@"yyyy"];
        NSString *yearstr = [year stringFromDate:date];
        NSDateFormatter *month = [[NSDateFormatter alloc]init];
        [month setDateFormat:@"MM"];
        NSString *monthstr = [month stringFromDate:date];
        NSDateFormatter *day = [[NSDateFormatter alloc]init];
        [day setDateFormat:@"dd"];
        NSString *daystr = [day stringFromDate:date];
        NSLog(@"%@:%@:%@",yearstr,monthstr,daystr);
    };
    [self.view addSubview:collection];