gpt4 book ai didi

ios - 以编程方式设置 EKEvent 标题

转载 作者:行者123 更新时间:2023-11-29 13:03:09 24 4
gpt4 key购买 nike

我正在尝试打开 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com