tags:

views:

39

answers:

2

i want to know that how to find the distance between from current location to another plz help me

A: 

There is a method to find the distance between two CLLocations.

CLLocationDistance distance = [firstLocation getDistanceFrom:secondLocation];
Anil Sivadas
This method has been deprecated since 3.2.
Gidogeek
+4  A: 
CLLocation *location = [[CLLocation alloc] initWithLatitude:doubleLattitude longitude:doubleLongitude];

        double distanceDouble; 

        if([user_Location respondsToSelector:@selector(distanceFromLocation:)])
            distanceDouble = [user_Location distanceFromLocation:location];
        else 
            distanceDouble = [user_Location getDistanceFrom:location];

This way you support both OS 4.0 and 3.0 since getDistanceFrom is depricated now.

In the above example user_Location is also a CLLocation object.

Gidogeek