iOS开发经验收集ios实用开发技巧iOS收藏

【IOS】根据地图经纬度计算两点间的距离

2017-07-17  本文已影响37人  雨影

采用系统自带的方法实现

//第一个坐标
 CLLocation *current=[[CLLocation alloc] initWithLatitude:32.178722 longitude:119.508619]; 
//第二个坐标
 CLLocation *before=[[CLLocation alloc] initWithLatitude:32.206340 longitude:119.425600]; 
// 计算距离 
CLLocationDistance meters=[current distanceFromLocation:before];
上一篇 下一篇

猜你喜欢

热点阅读