In my app, I am having a map view and two text boxes.
The text boxes contains the coordinates of the annotation.
If I enter the coordinates in those text boxes and press the submit button, an annotation for the corresponding coordinate is plotted.
But if I don't enter any value in the text boxes and press the submit button, an annotation is plotted at san francisco.
- (IBAction)submitButton:(id)sender
{
myCoordinate.latitude=[latitude_value.text floatValue];
myCoordinate.longitude=[longitude_value.text floatValue];
CLLocationDistance distance=1000;
MKCoordinateRegion newRegion=MKCoordinateRegionMakeWithDistance(myCoordinate, distance,distance);
[self.mapView setRegion:region animated:YES];
MKPointAnnotation* annotation = [[MKPointAnnotation alloc] init];
annotation.coordinate = myCoordinate;
[self.mapView addAnnotation:annotation];
}
The 2 text boxes are latitude_value and longitude_value.
Please help....!