私は自分用のアプリを作成しており、既にカレンダーにある特定のイベントの startDate と endDate にアクセスする必要があります。どうすればこれを行うことができますか?イベントのリストを配列に格納しようとしましたが、イベントが配列に格納されたら、どうすればそれらにアクセスできますか?
1 に答える
1
EKEventsのeventIdentifierプロパティを配列に保存できます。
EKEventStore *eventStore = [[EKEventStore alloc] init];
// Create the predicate from the event store's instance method
NSPredicate *predicate = [store predicateForEventsWithStartDate:oneDayAgo
endDate:oneYearFromNow
calendars:nil];
// Fetch all events that match the predicate
NSArray *eventsArray = [store eventsMatchingPredicate:predicate];
for (EKEvent *eventToCheck in eventsArray) {
if ([eventToCheck.eventIdentifier isEqualToString:[eventsIdentifierArray objectAtIndex:i]]) {
//Do your changes here
NSLog(@"%@", eventToCheck.startDate);
NSLog(@"%@", eventToCheck.endDate);
}
}
于 2012-09-10T17:07:20.377 に答える