Minkle Garg
Minkle Garg

Reputation: 1395

Set EKEvent title programmatically

I am trying to open the EKEventStore to set the reminder with in app. It is successfully opened with this following code

EKEventEditViewController *addController = [[EKEventEditViewController alloc] init];
addController.eventStore = self.eventStore;
addController.editViewDelegate = self;
[self presentViewController:addController animated:YES completion:nil];

But when I tried to add the EKEvent title programmatically it doesn't appear in the calendar.

For adding title code is 

EKEvent *addEvent = [EKEvent eventWithEventStore:self.eventStore];
addEvent.title = [NSString stringWithFormat:@"%@", textcontainer.text];

EKReminder *reminder = [EKReminder reminderWithEventStore:eventStore];
reminder.location=@"Ludhiana";

but its not working. Am I doing something wrong? Please help me out.

Thanks in advance.

Upvotes: 1

Views: 360

Answers (1)

Minkle Garg
Minkle Garg

Reputation: 1395

Thanks @satheeshwaran for look upon my query. but I have solved this by following:

EKEvent *addEvent = [EKEvent eventWithEventStore:self.eventStore];
addEvent.title=[NSString stringWithFormat:@"%@", textcontainer.text];
EKEventEditViewController *addController = [[EKEventEditViewController alloc] init];
addController.eventStore = self.eventStore;
addController.event=addEvent;
addController.editViewDelegate = self;
[self presentViewController:addController animated:YES completion:nil];

Upvotes: 1

Related Questions