I am making google map integration in iphone. I have to show current location showing in map. How will i get current location?
Thanks
CLLocationCoordinate2D location = [[[mapview userLocation] location] coordinate];
NSLog(@"Location found from Map: %f %f",location.latitude,location.longitude);
Search for Accessing the Device's Current Location
in following article:
MapView.showsUserLocation = YES;
)Related SO posts:
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:)
The short answer is to write code like mapview.showsUserLocation = YES;
, where mapview is your UIMapView class object.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.