I have an array of points on a map.
I populate the array correctly and I make annotations for them on the map. everything is working fine.
I have another tableview with the same array, and in the “subtitle” of the cells, I calculate the distance to user and present. everything working fine.
Now,I want to sort the list in the table view, in other words I want to sort the same array by distance, lowest to highest.
The thing is that the distance is not part of the array. so how can I cross match the distance with the array, so that when I sort the distance, it takes its belonging object in the array with it and sorts the array as well?
I am fairly new to ios but I have managed to release 3 apps now, and this one is the fourth, far more complex and I think I have covered pretty good ground with making the app so far. From the mapview, to the tableview with a search controller and everything. I am only missing the sorting.
I imagine I need to add some tag or property to each object in the array and assign it to each distance in the distance array.
Any suggestions would be appreciated 🙂
Thanks in advance.
1 Answer