i have distance in a variable of type CLLocationDistance i need to convert it in a integer variable how can i do it
i have use
CLLocationDistance kil
This will calculate the distance between two location by using the CLLocationDistance. By default it gives the values in meters. To convert to kilometers, divide the CLLocationDistance/1000.0. To get miles multiply the CLLocationDistance*0.62137.
//Pass your current location Latitude and longitude
CLLocation *currentlocation = [[CLLocation alloc] initWithLatitude:13.015370f longitude:80.200393f];
//Pass your destination location Latitude and longitude
CLLocation *destination = [[CLLocation alloc] initWithLatitude:37.420948f longitude:-122.09578499999998f];
CLLocationDistance meters = [currentlocation distanceFromLocation:destination];
//get distance in meters
NSLog(@"meters :%f", meters);
//get distance in kilometers
CLLocationDistance kilometers = meters / 1000.0;
NSLog(@"kilometers :%f", kilometers);
//Get distance in miles
NSLog(@"Miles:%f",kilometers*0.62137);
//convert kilometers to int value
int num=kilometers;