如何使用 eventKit 框架为特定日期设置提醒(闹钟)
我正在 iOS 5 中使用 EventKit 框架,并使用以下代码成功将事件添加到 iOS 日历中。
EKEventStore *eventDB = [[EKEventStore alloc] init];
EKEvent *myEvent = [EKEvent eventWithEventStore:eventDB];
myEvent.title = @"New Event";
myEvent.startDate = [[NSDate alloc] init];
myEvent.endDate = [[NSDate alloc] init];
myEvent.allDay = YES;
[myEvent setCalendar:[eventDB defaultCalendarForNewEvents]];
现在我该如何为此事件添加警报(提醒)?
谢谢 兰吉特
I am working with EventKit framework in iOS 5 and I successfully added an event to the iOS calendar using the below code
EKEventStore *eventDB = [[EKEventStore alloc] init];
EKEvent *myEvent = [EKEvent eventWithEventStore:eventDB];
myEvent.title = @"New Event";
myEvent.startDate = [[NSDate alloc] init];
myEvent.endDate = [[NSDate alloc] init];
myEvent.allDay = YES;
[myEvent setCalendar:[eventDB defaultCalendarForNewEvents]];
Now How shall i added an alarm (reminder) for this event ?
Thanks
Ranjit
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通过添加此代码 -
其中 min 是您想要显示警报的时间。这应该是一个负值,以便它出现在您的活动之前(分钟)。
享受!!!
By Adding this code -
Where min is the time when you want to show alert. this should be a negative value so that this will appear (min) before of your event.
Enjoy!!!