I am creating a map view in a view controller using a storyboard.
When I use the following code.
-(void) mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation { CLLocationDistance distance = 1000; MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(userLocation.coordinate, distance, distance); MKCoordinateRegion adjusted_region = [self.mapView regionThatFits:region]; [self.mapView setRegion:adjusted_region animated:YES]; }
Point built in San Francisco, California, USA. userLocation is a predefined value in MapKit.h . Now i create
-(void) mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation { CLLocationDistance distance = 1000; CLLocationCoordinate2D myCoordinate; myCoordinate.latitude = 13.04016; myCoordinate.longitude = 80.243044; MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(myCoordinate, distance, distance); MKCoordinateRegion adjusted_region = [self.mapView regionThatFits:region]; [self.mapView setRegion:adjusted_region animated:YES]; }
The area with the coordinate in the center is displayed here. But there is no point in the coordinate position.
How to build a point or annotation at this coordinate location?
ios mapkit
chandru
source share