views:

83

answers:

2

How can I get the longitude, and latitude of the current position showing on the mapView?

Thanks.

+2  A: 

Current window position:

float latitude = myMapView.centerCoordinate.latitude;
float longitude = myMapView.centerCoordinate.longitude;

Current user position:

CLLocation userLocation = myMapView.userLocation.location;
float latitude = userLocation.coordinate.latitude;
float longitude = userLocation.coordinate.latitude;
Seamus Campbell
by current location i didn't mean what u see in the center of the screen. I meant the real current location of myself. So basically i need the latitude and longitude of the blue circle on the screen that shows my current position
aryaxt
edited for you.
Seamus Campbell
thanks a lot that worked
aryaxt
+3  A: 

The map userLocation will not be set right away, often it's better to just use Core Location if you need to get the users location. After all if the map is already using the GPS, using Core Location is kind of free in that you are using no more power than the map does - you can still have the map display the users location too.

That will also tell you things like "GPS is not working" or "GPS is not available" which you can't find out from Mapkit.

Kendall Helmstetter Gelner