开发者

Calculate distance from Location - iPhone

开发者 https://www.devze.com 2023-01-12 21:38 出处:网络
I\'m trying to calculate the distance between two places user Core Location. I\'ve found a few posts that state to use

I'm trying to calculate the distance between two places user Core Location. I've found a few posts that state to use

-(CLLocationDistance)distanceFromLocation:(const CLLocation *)location

Found some other test code in the thread below:

CLLocationDistance NaN

I'm no开发者_开发问答t sure how to put it all together, to get the result I want ?

Anyone any thoughts ?

Regards, Stephen


If you have a location named myLocation and want to find the distance from another location, say, restaurantLocation, then it seems you would do something like

CLLocationDistance distance = [myLocation distanceFromLocation:restaurantLocation]

This will give you the distance, in meters, between the two.

0

精彩评论

暂无评论...
验证码 换一张
取 消