iOS Find nearest place

OriginalJef

macrumors newbie
Original poster
Mar 1, 2013
3
0
Hye,

I'm searching for a way to see the closed shop, calculated on your current location. I'm a noob in programming for iOS and can't find a way to do it.
The thing is that I have a table view controller with al the shops and I want to press the button it needs to filter the list and give only the nearest shop in the list.

Sorry for the bad english.

Pleas help,
Original jef
 

xArtx

macrumors 6502a
Mar 30, 2012
764
1
The short answer is measure the distance to all of them, and disqualify all but the closest.
What have you tried? What code have you written so far?
And how much have you searched this forum?
The spoon fed solution is right here!
 

Duncan C

macrumors 6502a
Jan 21, 2008
853
0
Northern Virginia
Hye,

I'm searching for a way to see the closed shop, calculated on your current location. I'm a noob in programming for iOS and can't find a way to do it.
The thing is that I have a table view controller with al the shops and I want to press the button it needs to filter the list and give only the nearest shop in the list.

Sorry for the bad english.

Pleas help,
Original jef
Create CLLocation objects for all your locations.

Then get the current location, and create a CLLocation object for that too.

Then use the CLLocation method distanceFromLocation to calculate the distance from the user's current location to each "shop" in your list of locations. Select the "shop" locations that are within your distance cutoff.

When the user moves a significant distance from his current location (say 1/2 kilometer) you'll need to recalculate your distances.