我在项目中工作需要带有事件的日历视图,我尝试了许多库,但最后我决定使用kal 库,因为它能够添加事件
日历.h
#import "Kal.h"
#import "NSDate+Convenience.h"
#import "EventKitDataSource.h"
@interface Calendar : UIViewController<WebService_Delegate , UITableViewDelegate >
{
KalViewController *kal;
id dataSource;
}
日历.m
- (void)viewDidLoad
{
[super viewDidLoad];
self.title = @"Caledar";
kal = [[KalViewController alloc]initWithSelectionMode:KalSelectionModeSingle];
kal.selectedDate = [NSDate dateStartOfDay:[NSDate date]];
kal.delegate = self;
kal.view.frame = CGRectMake(0, 65, kal.view.frame.size.width, kal.view.frame.size.height);
[kal showAndSelectDate:[NSDate date]];
//navController = [[UINavigationController alloc]initWithRootViewController:kal];
// [self.view addSubview:navController.view];
[self initVariable];
[self getEvents];
dataSource = [[EventKitDataSource alloc] init];
kal.dataSource = dataSource;
[self.view addSubview:kal.view];
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// Display a details screen for the selected event/row.
EKEventViewController *vc = [[EKEventViewController alloc] init];
vc.event = [dataSource eventAtIndexPath:indexPath];
//[vc setEvent:[events_array objectAtIndex:indexPath.row]];
vc.allowsEditing = NO;
[navController pushViewController:vc animated:YES];
}
如何将数据传递给 dataSource 以显示它
这里它的样子
我需要将事件列表设置到我的事件列表中,我得到了重复的事件,它从我的日历中读取
谢谢你