Placing blue point in mapKit with desired location
2 answers
Have you installed this?
mapView.showsUserLocation = YES;
Setting up a specific location is a bit tricky, but can certainly work without the undocumented APIs. See the following code:
- (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;
}
0
a source to share
Not sure if it is possible to set a custom CUSTOM location (usually people use the user's blue dot image). Although I'm not 100% sure, so you have a chance to try something like this to see if it's possible to deal with userLocation like MKAnnotation ...
CLLocationCoordinate2D c = self.mapView.userLocation.location.coordinate;
[[self.mapView userLocation] setCoordinate:c];
0
a source to share