ludo ludo - 2 years ago 131
Objective-C Question

Retrieve UserLocation Coordinate with MapKit

I"m using MapKit in my application and disaply the user location with

[mapview setShowUserLocation:YES];

I want to set the and with the coordinate of the userLocation, how to do it?

Answer Source

Here is my answer, I try something like that and its working:

//inside my ViewDidLOad
locManager = [[CLLocationManager alloc] init];
[locManager setDelegate:self];
[locManager setDesiredAccuracy:kCLLocationAccuracyBest];
[locManager startUpdatingLocation];

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation  {
CLLocationCoordinate2D loc = [newLocation coordinate]; [maptView setCenterCoordiante:loc]; }
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download