久久久久久久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>

        通過(guò) NSFetchedResultsController 按距離排序的核心數(shù)據(jù)

        Locations in Core Data sorted by distance via NSFetchedResultsController?(通過(guò) NSFetchedResultsController 按距離排序的核心數(shù)據(jù)中的位置?)
      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>

                  本文介紹了通過(guò) NSFetchedResultsController 按距離排序的核心數(shù)據(jù)中的位置?的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                  問(wèn)題描述

                  我的 iOS Core Data 數(shù)據(jù)庫(kù)中有一組實(shí)體對(duì)象,用于描述某個(gè)位置的某些內(nèi)容.讓我們稱實(shí)體位置.我通過(guò)在 Location 上有兩個(gè)引用位置的屬性來(lái)實(shí)現(xiàn)這一點(diǎn) - 緯度和經(jīng)度,都是雙精度的.還有其他元素,例如名稱.

                  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 將實(shí)體綁定到 UITableViewController.我想做的是讓結(jié)果按到給定 CLLocationCoordinate2D 的距離排序.在一個(gè)非常理想的情況下,我可以刷新該列表以根據(jù)新位置重新計(jì)算排序.因此,這種排序?qū)⑷Q于兩個(gè)鍵和第三個(gè)靜態(tài)"變量(一個(gè)不會(huì)在集合中的項(xiàng)目之間變化的變量).

                  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 對(duì)任意列表進(jìn)行排序,我想我可以弄清楚如何做到這一點(diǎn).但是,我不控制排序描述符在 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.

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

                  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.

                  推薦答案

                  (來(lái)自評(píng)論:)

                  (基于 SQLite)Core Data 存儲(chǔ)的獲取請(qǐng)求不能使用基于瞬態(tài)屬性或基于 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.

                  如果您不想失去獲取結(jié)果控制器的優(yōu)勢(shì)(如動(dòng)畫表格視圖更新、自動(dòng)分組到部分等),您必須預(yù)先計(jì)算到當(dāng)前位置的距離并將其存儲(chǔ)在 (對(duì)象的持久性)屬性.

                  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.

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

                  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.

                  這篇關(guān)于通過(guò) NSFetchedResultsController 按距離排序的核心數(shù)據(jù)中的位置?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

                  Help calculating X and Y from Latitude and Longitude in iPhone(幫助從 iPhone 中的緯度和經(jīng)度計(jì)算 X 和 Y)
                  Get user#39;s current location using GPS(使用 GPS 獲取用戶的當(dāng)前位置)
                  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 返回負(fù)速度)
                  How to detect Location Provider ? GPS or Network Provider(如何檢測(cè)位置提供者?GPS 或網(wǎng)絡(luò)提供商)

                      <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'>

                          • 主站蜘蛛池模板: 日韩欧美在线一区二区 | 久久久精品网 | 激情小说在线视频 | 秘密爱大尺度做爰呻吟 | 无遮挡在线观看 | 国产一级黄色录像 | 日韩黄色在线观看 | 中国特级毛片 | 日本黄色a级片 | 免费中文字幕 | 国产成人tv | 国产三级黄色片 | 亚洲av毛片成人精品 | 一级片中文字幕 | 色窝| 日韩av中文字幕在线播放 | 一区二区三区视频在线播放 | 日韩精品欧美 | 日韩视频免费在线观看 | 欧美a视频 | 亚洲狠狠干| www色 | 中文字幕av一区二区三区谷原希美 | 亚洲欧美日韩在线 | 成人一级视频 | 亚洲精品免费视频 | 国产一区二区精品在线 | 日韩亚洲一区二区 | 秋霞午夜鲁丝一区二区老狼 | 天天操天天操天天 | 自拍偷拍中文字幕 | 国产免费一区二区三区免费视频 | 欧美亚洲天堂 | 国产精品久免费的黄网站 | 免费看a级片 | 精品国产欧美 | 人人草人人干 | 国产精品久久久一区二区三区 | 亚洲男人的天堂在线观看 | 中文字幕+乱码+中文乱码91 | 午夜88|