ios - filtering two arrays one is NSArray(Core Data) and the other is NSMutableArray(simple) -
i getting core data in array consists of records , getting locations distance (2.5 km)example have filter 2 arrays distance
this code doing now
locations ...
locafilterarray = [[nsmutablearray alloc]init]; (int l = 0 ; l < dealarray.count; l++) { deal * deal = (deal *)dealarray[l]; nsarray * locarray = [[deal locationrelation]allobjects]; double minvalue = 10000; if (locarray.count > 0) { (int l = 0; l < locarray.count ; l++) { deallocation * location = (deallocation *)locarray[l]; double latitude = [[location latitude]doublevalue]; double longitude = [[location longitude]doublevalue]; cllocation * cdlocation = [[cllocation alloc]initwithlatitude:latitude longitude:longitude]; cllocation * currlocation = [[cllocation alloc]initwithlatitude:appdelegate.currentlatitude longitude:appdelegate.currentlongitude]; cllocationdistance distance = [currlocation distancefromlocation:cdlotion]/1000; if (distance < minvalue) { minvalue = distance; } } } else { minvalue = 5; } nsstring * value = [nsstring stringwithformat:@"%.1f",minvalue]; [locafilterarray addobject:value]; } nslog(@"%lu",(unsigned long)locafilterarray.count);
in way getting printed /// 2.5 , 1.2 , 18.3 , 4.5.... this
and core data getting date there no relation between these 2 arrays have filter core data data ascending order in table view
any great appreciations ... :)
Comments
Post a Comment