热门搜索 :
考研考公
您的当前位置:首页正文

IOS 计算两个经纬度之间的距离

来源:东饰资讯网

IOS中计算两个经纬度之间的距离:

-(double)distanceBetweenOrderBy:(double) lat1 :(double) lat2 :(double) lng1 :(double) lng2{

           CLLocation *curLocation = [[CLLocation alloc] initWithLatitude:lat1 longitude:lng1];
           CLLocation *otherLocation = [[CLLocation alloc] initWithLatitude:lat2 longitude:lng2];

            double  distance  = [curLocation distanceFromLocation:otherLocation];
            return  distance;
}
Top