2015-07-02 183 views

回答

0

試試這個

#import <CoreLocation/CoreLocation.h> 

CLLocation *locA = [[CLLocation alloc] initWithLatitude:lat1 longitude:long1]; 

CLLocation *locB = [[CLLocation alloc] initWithLatitude:lat2 longitude:long2]; 

CLLocationDistance distance = [locA distanceFromLocation:locB]; 

//Distance in Meters 

if((distance*1000)>5) 
{ 
    //return true; 
    // your coding 
} 
0

假設您已經點的座標。

CLLocation *locA = [[CLLocation alloc] initWithLatitude:lat1 longitude:long1]; 

CLLocation *locB = [[CLLocation alloc] initWithLatitude:lat2 longitude:long2]; 

CLLocationDistance distance = [locA distanceFromLocation:locB]; 

還需要#import <CoreLocation/CoreLocation.h>由Dharmesh Dhorajiya

提到