For demonstration purpose, i need to simulate the user location in a Mapkit view. It seems that it is possible with an undocumented API to place the blue dot anywhere on the map view. Unfortunately, i don't know witch undocumented API to use ? Any help ?
A:
Did you set this?
mapView.showsUserLocation = YES;
Setting a specific location is a bit more difficult, but certainly do-able without undocumented APIs. See code below:
- (void)animateToSelectedPlace:(CGFloat)zoomLevel {
MKCoordinateRegion region;
region.center = [self getCoordinateFromComponents:chosenLatitude:chosenLongitude];
MKCoordinateSpan span = {zoomLevel,zoomLevel};
region.span = span;
[mapView setRegion:region animated:YES];
}
-(CLLocationCoordinate2D)getCoordinateFromComponents:(NSNumber*)latitude:(NSNumber*)longitude {
CLLocationCoordinate2D coord;
coord.latitude = latitude.doubleValue;
coord.longitude = longitude.doubleValue;
return coord;
}
alku83
2010-05-11 07:43:06
I have tested with showsUserLocation=YES. but i need to set the blue point to a SPECIFIC location.Any idea, sample code ?
2010-05-11 16:54:31
Edited answer to include sample code, see how you go
alku83
2010-05-11 23:19:02
Thank you for your help.It'is not working.If i understand well, the animateToSelectPlace function is used to set the map location (center on the region definition) with animation.I have set mapView.showsUserLocation=YES but not blue point is displayed on the center of the map...Any other idea ?
2010-05-12 15:33:54
You can probably turn showsUserLocation off, as that won't help you zoom to a specific point. What are you passing in as the zoomLevel? Try something like 0.02 to start with. And are you sending in valid lat/long values?
alku83
2010-05-12 23:16:27
Hi,I have set a correct long/lat before the map is correctly centered on this point with the correct zoom Level.The pb i have is that not blue point is displayed on the center...I really think that it is not possible without using undocumented API... The blue point is provided by the location returned by the LocationManager...Any other idea
2010-05-13 08:52:35