Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

initialize event in EKEventEditViewController

Tags:

iphone

My code is following

EKEventEditViewController *addController = [[EKEventEditViewController alloc] initWithNibName:nil bundle:nil];


// set the addController's event store to the current event store.
addController.eventStore = self.eventStore;

// present EventsAddViewController as a modal view controller
[self presentModalViewController:addController animated:YES];

addController.editViewDelegate = self;
[addController release];

It will appear new event ViewController. I want to initialize title and note in EKEventEditViewController.

like image 826
saturngod Avatar asked Dec 06 '22 01:12

saturngod


1 Answers

I found a way.

EKEventStore *eventStore = [[EKEventStore alloc] init];
EKEvent *event  = [EKEvent eventWithEventStore:eventStore];
event.startDate = event_date;
event.endDate   = event_date;
event.notes=event_note;


EKEventEditViewController *addController = [[EKEventEditViewController alloc] initWithNibName:nil bundle:nil];


// set the addController's event store to the current event store.
addController.eventStore = eventStore;
addController.event=event;

// present EventsAddViewController as a modal view controller
[parent presentModalViewController:addController animated:YES];

addController.editViewDelegate = self;
[addController release];
like image 71
saturngod Avatar answered Dec 22 '22 21:12

saturngod