MKMapView userLocation, right position, wrong coord?
I am writing a test application with an MKMapView that appears when the application starts, right at the start I want to initialise the mapView to be more appropriate to where the user is so I am using userLocation
to get the the "users current location"
MKUserLocation *currentLocation = [[self mMapView] userLocation];
[[self mapView] setShowsUserLocation:YES];
This works fine and puts a pin in the correct place (all be it that the map is zoomed way out) I have two problems:
PROBLEM:(1)
MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance([[currentLocation location] coordinate], 200, 200);
[[self mapView] setRegion:region];
Even though the annotation pin is in the correct place (i.e. iOS clearly knows where I am) when I try and query the location coordinate I just get [0.0000] and [0.0000]
PROBLEM:(开发者_如何学JAVA2)
When I zoom or pan the map the pin drops again, so each time you move you get a new pin drop animation. Is there a way to stop this?
NOTE: I am using CLLocationManager later in my code, this was just something I was trying quickly when the application first loads to give the user a better feeling for where they were rather than just looking at the default zoomed out google map.
Solution for prob 1. Hey it works fine at the Device ..... In simulator it will show you as (0,0)
精彩评论