In my mapView application i am trying to make the annotation, Without adding annotation i am getting the mapView but when i try to add annotation, Only the annotation mark is visible the map becomes invisible.
Before adding Annotation:
Code:
[super viewDidLoad];
mapView = [[MKMapView alloc]initWithFrame:CGRectMake(0, 0, 320, elf.view.frame.size.height)];
mapView.showsUserLocation = YES;
mapView.mapType = MKMapTypeStandard;
mapView.delegate = self;
[self.view addSubview:mapView];
Image:
After Adding Annotation:
Code:
[super viewDidLoad];
mapView = [[MKMapView alloc]initWithFrame:CGRectMake(0, 0, 320, self.view.frame.size.height)];
mapView.showsUserLocation = YES;
mapView.mapType = MKMapTypeStandard;
mapView.delegate = self;
[self.view addSubview:mapView];
MKUserLocation *userLocation = mapView.userLocation;
MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(userLocation.location.coordinate, 20, 20);
[mapView setRegion:region];
MKPointAnnotation *annotation = [[MKPointAnnotation alloc]init];
annotation.coordinate = userLocation.location.coordinate;
annotation.title = @"Here you r";
annotation.subtitle = @"Pondy";
[mapView addAnnotation:annotation];
Image:
I need the annotation appear in the map. Thanks in advance.