Hello community,
i have the following code to get the userLocation on my app:
mapView.showsUserLocation=TRUE;
mapView.userLocation.title=@"Aktuelle Position";
that is in the viewDidLoad();
but how can i get latitude and longtitude in from userLocation in the following method??
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation{
Koordinate *user = mapView.userLocation;
Koordinate *cord1 = [eventPoints objectAtIndex:2];
CLLocation *loc1 = [[CLLocation alloc] initWithLatitude:cord1.latitude longitude:cord1.longtitude];
Koordinate *cord2 = [eventPoints objectAtIndex:3];
CLLocation *loc2 = [[CLLocation alloc] initWithLatitude:cord2.latitude longitude:cord2.longtitude];
double distance = [loc1 getDistanceFrom:loc2] / 1000;
NSLog(@"Distanz:", distance);
}
thank you all for helping beforehand