在我的项目中,我需要显示日历列表,用户可以在其中选择一个,根据选择我需要从设备日历应用程序中获取事件。有没有办法像下图一样显示默认日历列表,或者我应该自定义视图
请帮助解决这个问题。
在我的项目中,我需要显示日历列表,用户可以在其中选择一个,根据选择我需要从设备日历应用程序中获取事件。有没有办法像下图一样显示默认日历列表,或者我应该自定义视图
请帮助解决这个问题。
要在您想要使用的屏幕截图中显示视图EKCalendarChooser
。您可以通过 指定响应用户选择的行为EKCalendarChooserDelegate
。在此处查看 Apple 的文档:https ://developer.apple.com/documentation/eventkitui/ekcalendarhooser
let calendars =EventStore.calendars(for entityType:.Events)
// 获取事件
let eventStore = EventsManager.getEventStore()
var tempArray:[EKEvent] = []
let predicate = eventStore.predicateForEvents(withStart: startdate, end: endDate, calendars: calendars)//nil will include all the calendars
let events = eventStore.events(matching: predicate) as [EKEvent]
要从日历中获取会议,请使用此“使用表格视图和部分创建您自己的 UI 并请求日历的权限”。然后使用 .