FYCalendar

加入收藏
已有 3 人收藏

介绍:
    xcode7.2

    代码例子:

    @property (strong, nonatomic) FyCalendarView *calendarView;

    @property (nonatomic, strong) NSDate *date;

    

    - (void)setupCalendarView {

     self.calendarView = [[FyCalendarView alloc] initWithFrame:CGRectMake(10, 30, self.view.frame.size.width - 20, self.view.frame.size.width - 20)];

     //日期状态

     self.calendarView.allDaysArr = [NSArray arrayWithObjects: @"5", @"8", @"9", @"17", @"30", nil];

     self.calendarView.partDaysArr = [NSArray arrayWithObjects:@"1", @"2", @"26", @"12",@"15", @"19",nil];

     [self.view addSubview:self.calendarView];

    // self.calendarView.isShowOnlyMonthDays = NO;

     self.calendarView.date = [NSDate date];

     self.calendarView.calendarBlock = ^(NSInteger day, NSInteger month, NSInteger year){

     NSLog(@"%li-%li-%li", (long)year,(long)month,(long)day);

     };

     WS(weakSelf)

     self.calendarView.nextMonthBlock = ^(){

     [weakSelf setupNextMonth];

     };

     self.calendarView.lastMonthBlock = ^(){

     [weakSelf setupLastMonth];

     };

    }

测试环境:
  [Code4App]编译测试
效果图:
  • iOS / iPhone / iPad xcode7.2
<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;代码例子:
<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;@property (strong, nonatomic) FyCalendarView *calendarView;
<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;@property (nonatomic, strong) NSDate *date;
<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;
<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;- (void)setupCalendarView {
<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;    self.calendarView = [[FyCalendarView alloc] initWithFrame:CGRectMake(10, 30, self.view.frame.size.width - 20, self.view.frame.size.width - 20)];
<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;    //日期状态
<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;    self.calendarView.allDaysArr = [NSArray arrayWithObjects: @"5", @"8", @"9", @"17",  @"30", nil];
<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;    self.calendarView.partDaysArr = [NSArray arrayWithObjects:@"1", @"2", @"26", @"12",@"15", @"19",nil];
<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;    [self.view addSubview:self.calendarView];
<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;//    self.calendarView.isShowOnlyMonthDays = NO;
<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;    self.calendarView.date = [NSDate date];
<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;    self.calendarView.calendarBlock =  ^(NSInteger day, NSInteger month, NSInteger year){
<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;        NSLog(@"%li-%li-%li", (long)year,(long)month,(long)day);
<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;    };
<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;    WS(weakSelf)
<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;    self.calendarView.nextMonthBlock = ^(){
<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;        [weakSelf setupNextMonth];
<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;    };
<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;    self.calendarView.lastMonthBlock = ^(){
<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;        [weakSelf setupLastMonth];
<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;    };
<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;}
代码评论:
登录后方可评论

  
  • 暂无评论