简体   繁体   English

从TableView提取数据(CoreData)

[英]Fetching Data from TableView (CoreData)

I am building an app with Swift 3 and so far I have integrated the ability to store the user's location using CoreData and display them in a TableView. 我正在使用Swift 3构建应用程序,到目前为止,我已经集成了使用CoreData存储用户位置并将其显示在TableView中的功能。 Now I want to retrieve each location data (if there is any and up to 20 locations) to continue working with that. 现在,我想检索每个位置数据(如果有,最多20个位置),以继续进行操作。

I have trouble doing that, could someone assist me? 我这样做很麻烦,有人可以帮我吗?

Please check the stackOverFlow . 请检查stackOverFlow

It helps. 它有助于。

When using core data and a tableview, you should use NSFetchedResultsController. 使用核心数据和表格视图时,应使用NSFetchedResultsController。 This essentially retrieves data from core data and organizes it by section and indexPath so it can easily be set as the data source of the tableView. 这实际上是从核心数据中检索数据,并按section和indexPath对其进行组织,因此可以轻松地将其设置为tableView的数据源。

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

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