Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

show another view when map annotation are clicked

Tags:

I have a map with only one annotation.I created a simple class which I want it to show when the user clicks on the annotation.The problem is that when I click on the annotation nothing happens.

Here is my code:

- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark{
    NSLog(@"Reverse Geocoder completed");
    mPlacemark=placemark;
    [mapView addAnnotation:placemark];
}

- (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation{
    MKPinAnnotationView *annView=[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"currentloc"];
    annView.animatesDrop=TRUE;

    //create UIButton for annotation
    UIButton *detailButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
    //NSInteger annotationValue = [self.annotations indexOfObject:annotation];

    [detailButton addTarget:self action:@selector(showDetailView:) forControlEvents:UIControlEventTouchUpInside];
    annView.rightCalloutAccessoryView=detailButton;
    return annView;
}


-(void)showDetailView:(id)sender{
    NSLog("inside the stupid method");
    MyDetailViewController *detailView=[[MyDetailViewController alloc] initWithNibName:@"MyDetailViewController" bundle:nil];
    [[self navigationController] pushViewController:detailView animated:YES];
    [detailView release];
}

My showDetailView function never gets called.Please help me.I'm new to iphone and I might forget a simple thing.Thanks

Still not working!!!!