开发者

Calculate distance from Location - iPhone

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜