问题描述
是否可以重新排序 EKReminders EKCalendar 类型的提醒?在本机提醒应用程序中可以实现,但是我似乎在API中找不到此选项.
Is it possible to reorder EKReminders in EKCalendar of type reminders? In native Reminders app it is possible, but I can't seem to find this option in the API.
推荐答案
因此, EKCalendarItem
对象具有 calendarItemExternalIdentifier
,这对于跨设备的事件是唯一的.您可以利用此优势来实现这种订购策略.
So, EKCalendarItem
objects have calendarItemExternalIdentifier
which is unique to the event across devices. You can use this to your advantage for this ordering strategy.
每次您从Calendar API提取事件时,请在您选择的任何持久性存储(Core Data,SQLite,Property List等)中跟踪其 calendarItemExternalIdentifier
.是命令.
Every time you fetch events from the calendar API, keep track of their calendarItemExternalIdentifier
in whatever persistence store you choose (Core Data, SQLite, Property Lists, etc...) and also keep track of it's order.
因此,如果您使用核心数据,则可能会有一个具有两个属性的实体,分别是 calendarItemExternalIdentifier
和 order
.现在,无论何时将事件呈现给用户,都可以在持久存储中查询每个事件的顺序并进行相应显示.如果有新事件发生,请找到最高顺序并从此开始递增.当用户重新订购时,请为持久性存储中的相应记录设置订购密钥.
So if you used Core Data you might have an entity with two attributes, calendarItemExternalIdentifier
and order
. Now whenever you present the events to the user, query the persistent store for order of each event and display accordingly. If new events come in, find the highest order and increment from there. When the user re-orders, set the order key for the appropriate record in your persistent store.
这篇关于在列表中对EKReminder重新排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!