我正在尝试打开EKEventStore以在应用程序中设置提醒。使用以下代码成功打开了它

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

但是,当我尝试以编程方式添加EKEvent标题时,它没有出现在日历中。
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";

但它不起作用。难道我做错了什么?请帮帮我。

提前致谢。

最佳答案

感谢@satheeshwaran查看我的查询。但是我已经解决了以下问题:

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];

关于ios - 以编程方式设置EKEvent标题,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/19311488/

10-13 03:57