如何使用 iOS EKCalendarChooser 的结果更改为选定的日历?
我已经设置 EKCalendarChooser 来允许用户选择日历,并且我已经设置 EKCalendarChooserDelegate 协议来检查选择。我确实得到了日历ChooserDidFinish 有了结果,但我仍然不清楚如何切换到日历。我看到 selectedCalendars 属性,但我想我期待一种通过设置 eventStore 或标识符来设置选择日历的方法 - 我可能正在使用即将回来的 NSSet?
因此,当我更改日历时,我已经做了一些类似
self.defaultCalendar = [self.eventStore calendarWithIdentifier:identifier];
或 id 创建新日历
self.defaultCalendar = [EKCalendar calendarWithEventStore:eventStore];
self.defaultCalendar.title = @"Demo calendar";
self.defaultCalendar.source = localSource;
[eventStore saveCalendar:self.defaultCalendar commit:YES error:nil];
的操作,如何从 EKCalendarChooser 更改为新的选择日历?
I have setup EKCalendarChooser to allow user to pick a Calendar and I have setup EKCalendarChooserDelegate Protocol to check on selection. I do get a calendarChooserDidFinish
with the results but I still not clear how to change over to calendar. I see the selectedCalendars property but I guess I was expecting a way to set the the pick Calendar by setting eventStore or identifier - I may be having using using NSSet that is coming back?
So when I change a Calendar I have done something along the lines of
self.defaultCalendar = [self.eventStore calendarWithIdentifier:identifier];
or id creating a new Calendar
self.defaultCalendar = [EKCalendar calendarWithEventStore:eventStore];
self.defaultCalendar.title = @"Demo calendar";
self.defaultCalendar.source = localSource;
[eventStore saveCalendar:self.defaultCalendar commit:YES error:nil];
How do I change to new select Calendar from EKCalendarChooser ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我正确理解了您的问题,那么您正在寻找当您在委托方法中收到
calendarChooser.selectedCalendars
属性时如何设置日历?如果您只允许在
EKCalendarChooser
中设置一个日历,那么您可以执行以下操作:如果您允许选择多个日历,那么您需要循环遍历 NSSet 。
If I've understood your problem correctly, then your looking for how to set your calendar when you receive
calendarChooser.selectedCalendars
property in your delegate method?Provided you only allow one calendar to be set in your
EKCalendarChooser
then you can do something along the lines of:If you allow more than one calendar to be selected then you'll need to loop through the NSSet instead.