tags:

views:

40

answers:

1

i want to use the gps in google map to automatically locate the user current location. is mapkit framwork , the gps for iphone in objective-c.

+1  A: 

in viewDidLoad write

self.locationManager = [[[CLLocationManager alloc] init] autorelease];
self.locationManager.delegate = self; // Tells the location manager to send updates to this object

self.mapView.delegate = self;
self.locationManager.desiredAccuracy = kCLLocationAccuracyBest;
[self.locationManager startUpdatingLocation];

and then implement

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation

delegate method newLocation will be user's Location

locationManager is CLLocationManager * locationManager;

mihirpmehta