#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@end
#import "ViewController.h"
#import "PushController.h"
#import "WZYCalendar.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"WZYCalendar";
self.view.backgroundColor = [UIColor whiteColor];
[self setupCalendar]; // 初始化日历对象
}
- (void)setupCalendar {
CGFloat width = self.view.bounds.size.width - 20.0;
CGPoint origin = CGPointMake(10.0, 64.0 + 80.0);
// 传入Calendar的origin和width。自动计算控件高度
WZYCalendarView *calendar = [[WZYCalendarView alloc] initWithFrameOrigin:origin width:width];
NSLog(@"height --- %lf", calendar.frame.size.height);
// 点击某一天的回调
calendar.didSelectDayHandler = ^(NSInteger year, NSInteger month, NSInteger day) {
//做出响应事件
};
[self.view addSubview:calendar];
}