您可以尝试使用OCCalendarController,它非常简单舒适。只需下载压缩文件并获取以前缀OC命名的所有文件。
在OCCalendarViewController.m中,您可以通过自己以编程方式添加“确定”或“取消”按钮来进行必要的更改。
要在主文件中调用日历视图,请使用以下行,
//Here's where the magic happens
calVC = [[OCCalendarViewController alloc] initAtPoint:CGPointMake(150, 50) inView:self.view]; calVC.delegate = self; [self.view addSubview:calVC.view];
还要包括以下代表来接收日期选择(如果用户选择日期或日期范围)
- (void)completedWithStartDate:(NSDate *)startDate endDate:(NSDate *)endDate {
最后,您还可以使用代码自定义箭头(与日历视图一起出现),
[OCCalendarViewController alloc] initAtPoint:insertPoint inView:self.view arrowPosition:OCArrowPositionRight]
其余详细信息可在自述文件中找到。自己试试吧,它会像魅力一样工作。干杯!