简体   繁体   English

以编程方式设置EKEvent标题

[英]Set EKEvent title programmatically

I am trying to open the EKEventStore to set the reminder with in app. 我正在尝试打开EKEventStore以在应用程序中设置提醒。 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. 但是,当我尝试以编程方式添加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";

but its not working. 但它不起作用。 Am I doing something wrong? 难道我做错了什么? Please help me out. 请帮帮我。

Thanks in advance. 提前致谢。

Thanks @satheeshwaran for look upon my query. 感谢@satheeshwaran查看我的查询。 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];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM