简体   繁体   English

在列表中重新排序EKReminder

[英]Reorder EKReminder in a list

Is it possible to reorder EKReminders in EKCalendar of type reminders? 是否有可能重新排序EKRemindersEKCalendar类型的提醒? In native Reminders app it is possible, but I can't seem to find this option in the API. 在原生的Reminders应用程序中,它是可能的,但我似乎无法在API中找到此选项。

So, EKCalendarItem objects have calendarItemExternalIdentifier which is unique to the event across devices. 因此, EKCalendarItem对象具有calendarItemExternalIdentifier ,这对于跨设备的事件是唯一的。 You can use this to your advantage for this ordering strategy. 您可以使用此优势来实现此订购策略。

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. 每次从日历API中获取事件时,请在您选择的任何持久性存储(Core Data,SQLite,Property Lists等)中跟踪其calendarItemExternalIdentifier ,并跟踪其顺序。

So if you used Core Data you might have an entity with two attributes, calendarItemExternalIdentifier and order . 因此,如果您使用Core Data,您可能拥有一个具有两个属性的实体, calendarItemExternalIdentifierorder 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. 当用户重新订购时,请为持久性商店中的相应记录设置订单键。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM