为什么 EKCalendarChooser 的 selectedCalendars 属性为空?

发布于 2024-12-18 12:04:01 字数 163 浏览 2 评论 0原文

我有一个EKCalendarChoosere,它允许我选择日历。我看到日历和委托方法 (EKCalendarChooserDelegate) 被调用。但是,当我访问日历选择器的选定日历属性时,它们始终为空。是否需要手动添加它们,还是选择器处理这一问题?提前致谢

I have a EKCalendarChoosere which allows me to select calendars. I see the calendars and the delegate methods (EKCalendarChooserDelegate) get called. However when I access the selected calendars property of the calendar chooser they are always null. Does one need to manually add them or does the chooser handle that? Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

撑一把青伞 2024-12-25 12:04:01

如果您仍然对为什么 calendarChooserSelectionDidChange 方法为 selectedCalendars 返回 NULL 结果感兴趣。我也有同样的问题。

calendarChooserSelectionDidChange 委托方法被调用时,如果
EKCalendarChooser 使用 EKCalendarChooserSelectionStyleSingle 设置,一切正常。
但是,如果它是为 EKCalendarChooserSelectionStyleMultiple 设置的,则 calendarChooserSelectionDidChange 委托方法会触发,但 calendarChooser.selectedCalendars 将返回 NULL,除非您设置日历的 NSSet对于 EKCalendarChooser 设置时即:detailViewController.selectedCalendars =我选择的日历;或detailViewController.selectedCalendars = [NSSet setWithArray:[eventStore calendars]];

If you still are interested in why the calendarChooserSelectionDidChange method returns a NULL result for selectedCalendars. I was having the same issue.

When calendarChooserSelectionDidChange delegate method gets called, if the
EKCalendarChooser is setup using EKCalendarChooserSelectionStyleSingle everything works perfectly.
But if it's setup for EKCalendarChooserSelectionStyleMultiple, the calendarChooserSelectionDidChange delegate method fires, but the calendarChooser.selectedCalendars will return NULL, unless you set the NSSet of calendars for the EKCalendarChooser when setting it up i.e.: detailViewController.selectedCalendars = mySelectedCalendars; or detailViewController.selectedCalendars = [NSSet setWithArray:[eventStore calendars]];

酒解孤独 2024-12-25 12:04:01

似乎没有必要填充NSSet,只需分配初始化它(在EKCalendarChooserviewDidLoad中):EKCalendarChooser 多项选择不起作用

Seems it is not necessary to populate the NSSet, just alloc-init it (in EKCalendarChooser's viewDidLoad): EKCalendarChooser multiple selection does not work

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文