0

I have setup EKCalendarChooser to allow user to pick a Calendar and I have setup EKCalendarChooserDelegate Protocol to check on selection. I do get a calendarChooserDidFinish with the results but I still not clear how to change over to calendar. I see the selectedCalendars property but I guess I was expecting a way to set the the pick Calendar by setting eventStore or identifier - I may be having using using NSSet that is coming back?

So when I change a Calendar I have done something along the lines of

  self.defaultCalendar = [self.eventStore calendarWithIdentifier:identifier];

or id creating a new Calendar

    self.defaultCalendar = [EKCalendar calendarWithEventStore:eventStore];
    self.defaultCalendar.title = @"Demo calendar";
    self.defaultCalendar.source = localSource;
    [eventStore saveCalendar:self.defaultCalendar commit:YES error:nil];

How do I change to new select Calendar from EKCalendarChooser ?

4

1 に答える 1

0

calendarChooser.selectedCalendars私があなたの問題を正しく理解していれば、デリゲート メソッドでプロパティを受け取ったときにカレンダーを設定する方法をお探しですか?

カレンダーを 1 つだけ設定EKCalendarChooserできる場合は、次のようなことができます。

- (void)calendarChooserSelectionDidChange:(EKCalendarChooser *)calendarChooser
{
    EKCalendar *newCalendar = [calendarChooser.selectedCalendars anyObject];
}

複数のカレンダーを選択できるようにする場合は、代わりに NSSet をループする必要があります。

于 2012-02-22T08:52:26.557 に答える