简体   繁体   English

使用数据,iOS,Swift 3刷新表的内存效率最高的方法是什么?

[英]What is the most memory efficient way to refresh table with data, iOS, Swift 3?

What is the most memory/battery-efficient approach for an app that shows table view with meetings? 对于显示会议桌面视图的应用程序,内存/电池效率最高的方法是什么? Meetings can be eventually updated any moment from third party side (there is no way to be notified about it, it just fetches meetings from iOS native calendar): 会议最终可以从第三方进行更新(无法获得有关它的通知,它只是从iOS本机日历中获取会议):

  1. Refresh screen every minute (thus re-building the same amount of cells that are present on the screen, 5-6 cells at most). 每分钟刷新一次屏幕(从而重新构建屏幕上存在的相同数量的单元格,最多5-6个单元格)。

  2. Fetch meetings in the background, and compare the objects with equatable protocol (object Meeting has references to other objects, that have in turn their own objects, and every level needs to be compared to be sure two objects are equal), and only IF the object has changed, reload table with data? 在后台获取会议,并将对象与等同协议进行比较(对象会对其他对象进行引用,而这些对象又有自己的对象,并且需要比较每个级别以确保两个对象相等),并且仅在对象已更改,用数据重新加载表?

Have you looked into Observing External Changes to the Calendar Database? 您是否考虑过观察日历数据库的外部更改? From Apple's docs: 来自Apple的文档:

An EKEventStore object posts an EKEventStoreChangedNotification notification whenever it detects changes to the Calendar database. 每当EKEventStore对象检测到对Calendar数据库的更改时,它就会发布EKEventStoreChangedNotification通知。 Register for this notification if your app handles event or reminder data. 如果您的应用处理事件或提醒数据,请注册此通知。

That's where I would start --- gotta be a much better way to go about it than to "refresh" every minute... 这就是我将开始---得是一个更好的方法去了解它,而不是“刷新”每一分钟......

ref: https://developer.apple.com/library/content/documentation/DataManagement/Conceptual/EventKitProgGuide/ObservingChanges/ObservingChanges.html#//apple_ref/doc/uid/TP40009765-CH4-SW1 参考: https//developer.apple.com/library/content/documentation/DataManagement/Conceptual/EventKitProgGuide/ObservingChanges/ObservingChanges.html#//apple_ref/doc/uid/TP40009765-CH4-SW1

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

相关问题 在iOS上缩小图像的内存效率最高的方法是什么? - What is the most memory-efficient way of downscaling images on iOS? 在swift和IOS中使用标题创建表选择视图的最有效方法 - Most efficient way of creating a table select view, with headings in swift & IOS 在 iOS 中显示多列表格的最有效方法是什么? - What is the most efficient way to display a table with multiple columns in iOS? 在iOS上显示CVImageBufferRef的最有效方法是什么 - What is the most efficient way to display CVImageBufferRef on iOS 在Swift中存储数据的最有效方法 - Most Efficient way to Store Data in Swift 在iOS应用上保存数据的最有效方法 - Most efficient way to save data on iOS Apps 在iOS中追踪时间的最有效/最精确的方法是什么? - What's the most efficient / most precise way to track time in iOS? 使用核心数据的最有效方法是什么? - What is the most efficient way to use Core Data? 在iOS中制作凸起/圆形按钮最有效的内存方式? - Most memory efficient way to make a bulging/rounded button in iOS? 在iOS上将高清视频缩减为SD的最快,最有效的方法是什么? - What is the fastest and most efficient way on iOS to downscale a HD video to SD?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM