Reputation: 1387
I am making google map integration in iphone. I have to show current location showing in map. How will i get current location ?
Thanks
Upvotes: 1
Views: 10154
Reputation: 31
I think the question has been answered -
CLLocationCoordinate2D location = [[[mapview userLocation] location] coordinate];
NSLog(@"Location found from Map: %f %f",location.latitude,location.longitude);
place this in the viewdidappear:animated
then you should find that you have the right location. Doing it any sooner and the location won't be set yet and you'll probably end up in the ocean :)
Upvotes: 3
Reputation: 1751
CLLocationCoordinate2D location = [[[mapview userLocation] location] coordinate];
NSLog(@"Location found from Map: %f %f",location.latitude,location.longitude);
Upvotes: 5
Reputation: 42143
Search for Accessing the Device’s Current Location
in following article:
MapView.showsUserLocation = YES;
)Related SO posts:
Upvotes: 3
Reputation: 778
The short answer is to write code like mapview.showsUserLocation = YES;
, where mapview is your UIMapView class object.
Upvotes: 1