I am trying to make an application that requires the user to log their current location, then have the pin stay there. So if I had a map view I would have a mapview and then a button on the bottom of the screen, allowing the user to place a pin where their current location is.
- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation
{
MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(userLocation.coordinate, 800, 800);
[self.mapview setRegion:[self.mapview regionThatFits:region] animated:YES];
// Add an annotation
MKPointAnnotation *point = [[MKPointAnnotation alloc] init];
point.coordinate = userLocation.coordinate;
point.title = @"Where am I?";
point.subtitle = @"I'm here!!!";
[self.mapview addAnnotation:point];
}
I have used that code to place a pin where my current location is, but I need that to happen after a button is tapped. I also need that pin to stay where they tapped it, so If they move ater on the pin will stay where they tapped it.
Thanks for you help!