Search code examples
iosios5eventkit

EKCalendarChooser new Calendar


Is it possible to show the enable adding new calendars in EKCalendarChooser just like the default iPhone Calendar app shows the + in the upper left corner and allows you to define you calendars?


Solution

  • I've been seeking the same ready-to-use solution for almost a day and no luck so far..

    The good thing is, however, that you can call

    [yourEKCalendarChooserInstance setEditing:YES];
    

    And It will show you the "Add Calendar" row

    But the bad thing is that nothing happens on click/select. That's all I found out so far

    UPDATE:

    this code worked for me (test only on simulator so far):

    EKEventStore *store = [[[EKEventStore alloc] init] autorelease];
    EKCalendarChooser *chooser = [[EKCalendarChooser alloc] initWithStyle:EKCalendarChooserSelectionStyleSingle displayStyle:EKCalendarChooserDisplayWritableCalendarsOnly eventStore:store];
    [chooser setEditing:YES];
    [chooser setShowsDoneButton:YES];
    [chooser setShowsCancelButton:YES];
    UINavigationController *modalController = [[UINavigationController alloc] initWithRootViewController:chooser];
    [self presentViewController:modalController animated:YES completion:nil];
    

    In addition, of course, you will need to provide delegate for done/cancel buttons.