pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

  • <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="g08qoio" 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="kwcm4wm" 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="ks20wca" id='wZxuf'><tfoot id='wZxuf'></tfoot><dl id='wZxuf'><fieldset id='wZxuf'></fieldset></dl></div>

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

                          • 主站蜘蛛池模板: 安德建奇火花机-阿奇夏米尔慢走丝|高维|发那科-北京杰森柏汇 | 软装设计-提供软装装饰和软装配饰及软装陈设的软装设计公司 | 全自动过滤器_反冲洗过滤器_自清洗过滤器_量子除垢环_量子环除垢_量子除垢 - 安士睿(北京)过滤设备有限公司 | 塑料检查井_双扣聚氯乙烯增强管_双壁波纹管-河南中盈塑料制品有限公司 | 杭州标识标牌|文化墙|展厅|导视|户内外广告|发光字|灯箱|铭阳制作公司 - 杭州标识标牌|文化墙|展厅|导视|户内外广告|发光字|灯箱|铭阳制作公司 | 一礼通 (www.yilitong.com)-企业礼品解决方案一站式服务平台 | 海峰资讯 - 专注装饰公司营销型网站建设和网络营销培训 | 深圳VI设计-画册设计-LOGO设计-包装设计-品牌策划公司-[智睿画册设计公司] | 氧化铁红厂家-淄博宗昂化工 | 单机除尘器 骨架-脉冲除尘器设备生产厂家-润天环保设备 | 便携式XPDM露点仪-在线式防爆露点仪-增强型烟气分析仪-约克仪器 冰雕-冰雪世界-大型冰雕展制作公司-赛北冰雕官网 | 蜘蛛车-高空作业平台-升降机-高空作业车租赁-臂式伸缩臂叉装车-登高车出租厂家 - 普雷斯特机械设备(北京)有限公司 | 整车VOC采样环境舱-甲醛VOC预处理舱-多舱法VOC检测环境仓-上海科绿特科技仪器有限公司 | 高压微雾加湿器_工业加湿器_温室喷雾-昌润空气净化设备 | 焊缝跟踪系统_激光位移传感器_激光焊缝跟踪传感器-创想智控 | 旗帜网络笔记-免费领取《旗帜网络笔记》电子书 | 多物理场仿真软件_电磁仿真软件_EDA多物理场仿真软件 - 裕兴木兰 | 【化妆品备案】进口化妆品备案流程-深圳美尚美化妆品有限公司 | 涿州网站建设_网站设计_网站制作_做网站_固安良言多米网络公司 | 电液推杆生产厂家|电动推杆|液压推杆-扬州唯升机械有限公司 | 反渗透水处理设备|工业零排放|水厂设备|软化水设备|海南净水设备--海南水处理设备厂家 | 学校用栓剂模,玻璃瓶轧盖钳,小型安瓿熔封机,实验室安瓿熔封机-长沙中亚制药设备有限公司 | 卷筒电缆-拖链电缆-特种柔性扁平电缆定制厂家「上海缆胜」 | 瓶盖扭矩测试仪-瓶盖扭力仪-全自动扭矩仪-济南三泉中石单品站 | 原色会计-合肥注册公司_合肥代理记账公司_营业执照代办 | 四合院设计_四合院装修_四合院会所设计-四合院古建设计与建造中心1 | VI设计-LOGO设计公司-品牌设计公司-包装设计公司-导视设计-杭州易象设计 | 包装机_厂家_价格-山东包装机有限公司 | 网优资讯-为循环资源、大宗商品、工业服务提供资讯与行情分析的数据服务平台 | 槽钢冲孔机,槽钢三面冲,带钢冲孔机-山东兴田阳光智能装备股份有限公司 | 飞象网 - 通信人每天必上的网站 全球化工设备网—化工设备,化工机械,制药设备,环保设备的专业网络市场。 | 美缝剂_美缝剂厂家_美缝剂加盟-地老板高端瓷砖美缝剂 | 合肥办公室装修 - 合肥工装公司 - 天思装饰 | 济南网站策划设计_自适应网站制作_H5企业网站搭建_济南外贸网站制作公司_锐尚 | 气动|电动调节阀|球阀|蝶阀-自力式调节阀-上海渠工阀门管道工程有限公司 | LINK FASHION 童装·青少年装展 河南卓美创业科技有限公司-河南卓美防雷公司-防雷接地-防雷工程-重庆避雷针-避雷器-防雷检测-避雷带-避雷针-避雷塔、机房防雷、古建筑防雷等-山西防雷公司 | GAST/BRIWATEC/CINCINNATI/KARL-KLEIN/ZIEHL-ABEGG风机|亚喜科技 | 冷凝水循环试验箱-冷凝水试验箱-可编程高低温试验箱厂家-上海巨为(www.juweigroup.com) | 定制/定做衬衫厂家/公司-衬衫订做/订制价格/费用-北京圣达信 | 河南砖机首页-全自动液压免烧砖机,小型砌块水泥砖机厂家[十年老厂] | 培训中心-翰香原香酥板栗饼加盟店总部-正宗板栗酥饼技术 |