iPhone 日历中的多日活动
我想添加一个事件,但该事件在所有日子中都添加了。如果我添加最后日期为 10 天后的事件,则该事件将在今天以及从今天到 10 天后的所有日期添加。我只想在结束日期添加事件,而不是在这几天之间添加事件。我该怎么做?
EKEventStore *eventStore = [[EKEventStore alloc] init];
EKEvent *event = [EKEvent eventWithEventStore:eventStore];
event.title = appDelegate.Name;
event.startDate = [[NSDate alloc] init];
event.endDate = appDelegate.Date_iCal;
//event.allDay = NO;
[event setCalendar:[eventStore defaultCalendarForNewEvents]];
NSError *err;
[eventStore saveEvent:event span:EKSpanThisEvent error:&err];
I want to add an event but the event is added in all the days. If I add an event which has a last date after 10 days, then the event is added today and all the days between today and 10 days from now. I want to just add the event at the end date, not between these days. How can I do this?
EKEventStore *eventStore = [[EKEventStore alloc] init];
EKEvent *event = [EKEvent eventWithEventStore:eventStore];
event.title = appDelegate.Name;
event.startDate = [[NSDate alloc] init];
event.endDate = appDelegate.Date_iCal;
//event.allDay = NO;
[event setCalendar:[eventStore defaultCalendarForNewEvents]];
NSError *err;
[eventStore saveEvent:event span:EKSpanThisEvent error:&err];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须指定正确的开始日期。
现在你这样做
,这显然会添加一个现在开始并在未来某个地方结束的事件。
我对你的活动一无所知,所以你必须自己弄清楚它的开始和结束。
you have to specify the correct start date.
Right now you do this
and this will obviously add an event that starts now and ends somewhere in the future.
I don't know anything about your event, so you have to figure out the start and end of it on your own.