0

enter image description here

i want to get detail disclosure button when i click red pin.

- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation {



static NSString *identifier = @"RoutePinAnnotation";



if ([annotation isKindOfClass:[UICRouteAnnotation class]]) {


    pinAnnotation = (MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:@"pinAnnotation"];


    if(!pinAnnotation) {
        NSLog(@"entered");
        pinAnnotation = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"pinAnnotation"] autorelease];               

        pinAnnotation.canShowCallout = YES;
        pinAnnotation.pinColor = MKPinAnnotationColorGreen;

        rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
        pinAnnotation.rightCalloutAccessoryView = rightButton;

          }
    }

i used this code for getting detail disclosure button for two location(green pin) and midpoint.

  • is not working.please any one tell its possible to put detail disclosure but on red pin(restaurant). – vishnu sivabalan Jun 17 '13 at 06:53
  • So the red pins are not of type UICRouteAnnotation? Just add an if-statement to handle their class and set the rightCalloutAccessoryView. –  Jun 17 '13 at 11:53
  • thanks for your reply anna karenina.i got name,address,rating and other details for all red pins and i can print only name and address in the table when i select.i can't get rating.NSString *ratin=selectedAnnotation.rating; is not working,pls help me – vishnu sivabalan Jun 18 '13 at 10:44
  • The question in your Question and the question in your comment don't match (they are two separate problems). Regarding your posted Question: What type of annotation are the red pins? MKPointAnnotation or some custom type? What is the rest of the code in viewForAnnotation? Either way, handle them similar to how UICRouteAnnotation is handled. Regarding comment about accessing rating property, see http://stackoverflow.com/questions/5939223/store-data-in-mkannotation. –  Jun 18 '13 at 12:27

0 Answers0