参阅事件套件编程指南位于:
http://developer.apple.com/library/ios/#documentation/DataManagement/Conceptual/EventKitProgGuide/Introduction/Introduction.html
下面是苹果的示例代码:https://developer.apple.com/library/ios/samplecode/SimpleEKDemo/Introduction/Intro.html
的用于添加事件的代码使用EKEventEditViewController:
// Create an instance of EKEventEditViewController
EKEventEditViewController *addController = [[EKEventEditViewController alloc] init];
// Set addController's event store to the current event store
addController.eventStore = self.eventStore;
addController.editViewDelegate = self;
[self presentViewController:addController animated:YES completion:nil];
加入后,您可以获取使用代码来自教程,检索事件与谓词(在这种情况下日期)事件:
NSDate *startDate = [NSDate date];
//Create the end date components
NSDateComponents *tomorrowDateComponents = [[NSDateComponents alloc] init];
tomorrowDateComponents.day = 1;
NSDate *endDate = [[NSCalendar currentCalendar] dateByAddingComponents:tomorrowDateComponents
toDate:startDate
options:0];
// We will only search the default calendar for our events
NSArray *calendarArray = [NSArray arrayWithObject:self.defaultCalendar];
// Create the predicate
NSPredicate *predicate = [self.eventStore predicateForEventsWithStartDate:startDate
endDate:endDate
calendars:calendarArray];
// Fetch all events that match the predicate
NSMutableArray *events = [NSMutableArray arrayWithArray:[self.eventStore eventsMatchingPredicate:predicate]];
return events;
让我检查一下,它会为我服务以及将为其接受我的个人日历并使用JSON将数据发送到Web平台? 我不使用本地日历 谢谢 –
非常感谢你我正在看教程现在, –
我看了视频,它很有用,但我不使用默认日历,所以我不知道是否需要其他类型的东西,因为我使用JSON在网络平台中添加事件 –