久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <tfoot id='NdM0a'></tfoot>
        <i id='NdM0a'><tr id='NdM0a'><dt id='NdM0a'><q id='NdM0a'><span id='NdM0a'><b id='NdM0a'><form id='NdM0a'><ins id='NdM0a'></ins><ul id='NdM0a'></ul><sub id='NdM0a'></sub></form><legend id='NdM0a'></legend><bdo id='NdM0a'><pre id='NdM0a'><center id='NdM0a'></center></pre></bdo></b><th id='NdM0a'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='NdM0a'><tfoot id='NdM0a'></tfoot><dl id='NdM0a'><fieldset id='NdM0a'></fieldset></dl></div>
      1. <small id='NdM0a'></small><noframes id='NdM0a'>

        <legend id='NdM0a'><style id='NdM0a'><dir id='NdM0a'><q id='NdM0a'></q></dir></style></legend>

          <bdo id='NdM0a'></bdo><ul id='NdM0a'></ul>

        通過 NSFetchedResultsController 按距離排序的核心數據

        Locations in Core Data sorted by distance via NSFetchedResultsController?(通過 NSFetchedResultsController 按距離排序的核心數據中的位置?)
      2. <i id='AgxvS'><tr id='AgxvS'><dt id='AgxvS'><q id='AgxvS'><span id='AgxvS'><b id='AgxvS'><form id='AgxvS'><ins id='AgxvS'></ins><ul id='AgxvS'></ul><sub id='AgxvS'></sub></form><legend id='AgxvS'></legend><bdo id='AgxvS'><pre id='AgxvS'><center id='AgxvS'></center></pre></bdo></b><th id='AgxvS'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='AgxvS'><tfoot id='AgxvS'></tfoot><dl id='AgxvS'><fieldset id='AgxvS'></fieldset></dl></div>
        <legend id='AgxvS'><style id='AgxvS'><dir id='AgxvS'><q id='AgxvS'></q></dir></style></legend>

            <tbody id='AgxvS'></tbody>

              <bdo id='AgxvS'></bdo><ul id='AgxvS'></ul>

            • <small id='AgxvS'></small><noframes id='AgxvS'>

              <tfoot id='AgxvS'></tfoot>

                  本文介紹了通過 NSFetchedResultsController 按距離排序的核心數據中的位置?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我的 iOS Core Data 數據庫中有一組實體對象,用于描述某個位置的某些內容.讓我們稱實體位置.我通過在 Location 上有兩個引用位置的屬性來實現這一點 - 緯度和經度,都是雙精度的.還有其他元素,例如名稱.

                  I have a set of entity objects in my iOS Core Data database that describe something at a location. Let's call the entity Location. I have implemented this by having two attributes on Location that refer to the location - latitude and longitude, both doubles. There are other elements, like name.

                  我正在使用 NSFetchedResultsController 將實體綁定到 UITableViewController.我想做的是讓結果按到給定 CLLocationCoordinate2D 的距離排序.在一個非常理想的情況下,我可以刷新該列表以根據新位置重新計算排序.因此,這種排序將取決于兩個鍵和第三個靜態"變量(一個不會在集合中的項目之間變化的變量).

                  I am using a NSFetchedResultsController to bind the entities to a UITableViewController. What I would like to do is have the results sorted by distance to a given CLLocationCoordinate2D. In an really ideal scenario, I'm able to refresh that list to recalculate the sort based on a new location. Therefore, this sort would depend on two keys, and a third "static" variable (one that doesn't vary across the items in the collection).

                  如果我使用 NSSortDescriptors 對任意列表進行排序,我想我可以弄清楚如何做到這一點.但是,我不控制排序描述符在 NSFetchedResultsController 中的使用方式.

                  I think I could figure out how to do this if I was sorting an arbitrary list with NSSortDescriptors. However, I don't control how the sort descriptors are used in an NSFetchedResultsController.

                  有沒有一種方法可以配置我的實體、我的 NSFetchedResultsController、我的 NSSortDescriptors 等來完成此任務?我懷疑答案不在于創建一個花哨的 NSSortDescriptor,而是在實體中創建一個表示與我的距離的瞬態屬性,并定期重新計算該屬性.但是,我對 Core Data 還很陌生,所以我不確定如何最好地做到這一點(遍歷所有實體并重新計算一個字段).我也不確定 NSSortDescriptors 是否適用于瞬態屬性.

                  Is there a way that I could configure my entities, my NSFetchedResultsController, my NSSortDescriptors, etc. to accomplish this? I suspect that the answer lies not in creating a fancy NSSortDescriptor but instead in creating a transient attribute in the entity that represents the distance-to-me, and recalculating that attribute periodically. However, I'm new enough to Core Data that I'm not sure how to best do this (iterate over all entities and recalculate a field). I'm also not sure if NSSortDescriptors will work on Transient attributes.

                  推薦答案

                  (來自評論:)

                  (基于 SQLite)Core Data 存儲的獲取請求不能使用基于瞬態屬性或基于 Objective-C 謂詞的排序描述符.

                  A fetch request for a (SQLite based) Core Data store cannot use sort descriptors based on transient attributes or Objective-C based predicates.

                  如果您不想失去獲取結果控制器的優勢(如動畫表格視圖更新、自動分組到部分等),您必須預先計算到當前位置的距離并將其存儲在 (對象的持久性)屬性.

                  If you don't want to loose the advantages of a fetched results controller (like animated table view updates, automatic grouping into sections etc.) you have to pre-compute the distance to the current location and store it in a (persistent) attribute of your objects.

                  或者,您可以獲取所有對象并在內存中對其進行排序.在這種情況下,您可以使用任意排序描述符.但這不能與獲取的結果控制器結合使用,因此您必須注冊托管對象上下文中的更改并在必要時重新加載表.

                  Alternatively, you could fetch all objects and sort them in memory. In that case you can use arbitrary sort descriptors. But that cannot be combined with a fetched results controller, so you would have to register for changes in the managed object context and reload the table if necessary.

                  這篇關于通過 NSFetchedResultsController 按距離排序的核心數據中的位置?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Help calculating X and Y from Latitude and Longitude in iPhone(幫助從 iPhone 中的緯度和經度計算 X 和 Y)
                  Get user#39;s current location using GPS(使用 GPS 獲取用戶的當前位置)
                  IllegalArgumentException thrown by requestLocationUpdate()(requestLocationUpdate() 拋出的 IllegalArgumentException)
                  How reliable is LocationManager#39;s getLastKnownLocation and how often is it updated?(LocationManager 的 getLastKnownLocation 有多可靠,多久更新一次?)
                  CLLocation returning negative speed(CLLocation 返回負速度)
                  How to detect Location Provider ? GPS or Network Provider(如何檢測位置提供者?GPS 或網絡提供商)

                      <legend id='wZxuf'><style id='wZxuf'><dir id='wZxuf'><q id='wZxuf'></q></dir></style></legend>
                        • <bdo id='wZxuf'></bdo><ul id='wZxuf'></ul>
                          <tfoot id='wZxuf'></tfoot>
                            <tbody id='wZxuf'></tbody>

                        • <i id='wZxuf'><tr id='wZxuf'><dt id='wZxuf'><q id='wZxuf'><span id='wZxuf'><b id='wZxuf'><form id='wZxuf'><ins id='wZxuf'></ins><ul id='wZxuf'></ul><sub id='wZxuf'></sub></form><legend id='wZxuf'></legend><bdo id='wZxuf'><pre id='wZxuf'><center id='wZxuf'></center></pre></bdo></b><th id='wZxuf'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='wZxuf'><tfoot id='wZxuf'></tfoot><dl id='wZxuf'><fieldset id='wZxuf'></fieldset></dl></div>

                            <small id='wZxuf'></small><noframes id='wZxuf'>

                          • 主站蜘蛛池模板: 中文字幕av一区 | 精品国产乱码久久久久久88av | 日韩一区二区三区四区五区 | 中文字幕一页二页 | 日韩电影在线一区 | 午夜免费精品视频 | 久久国产精品久久久久久 | 中文字幕av在线 | 久草精品视频 | 国产精品成人在线播放 | 亚洲激情一区二区 | 亚洲国产中文字幕 | 午夜精品视频一区 | 国产在线精品一区二区 | 在线观看免费高清av | 天天综合天天 | 欧美一区二区免费 | 久久精品av | 黄色一级电影在线观看 | 欧美视频1 | 日日碰狠狠躁久久躁96avv | 91传媒在线观看 | 久草青青 | www.夜夜草 | 日韩在线一区二区三区 | 午夜国产一区 | 在线免费国产 | 91国产精品 | 国产精品精品视频一区二区三区 | 久久国产亚洲 | 久久精品网 | 成人激情视频网 | 最新日韩欧美 | 三级成人在线 | 成人精品一区二区三区中文字幕 | 国产日韩久久 | 日韩在线91 | 在线免费中文字幕 | 亚洲高清在线 | 久久精品福利视频 | 亚洲91|