为什么 EKCalendarChooser 的 selectedCalendars 属性为空?
我有一个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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您仍然对为什么 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]];
似乎没有必要填充
NSSet
,只需分配初始化它(在EKCalendarChooser
的viewDidLoad
中):EKCalendarChooser 多项选择不起作用Seems it is not necessary to populate the
NSSet
, just alloc-init it (inEKCalendarChooser
'sviewDidLoad
): EKCalendarChooser multiple selection does not work