Button-Aktion in der Mkannotation-Ansicht funktioniert nicht?

Hallo, ich habe in einer Situation auf der Karte festgehalten, in der es mir gelungen ist, benutzerdefinierte Anmerkungen anzuzeigen. Wenn die Anmerkung angetippt wird, muss ich eine Ansicht mit etwas Information und einem Knopf zeigen. Wenn der Benutzer auf die Schaltfläche tippt, sollte eine Warnung angezeigt werden.

code ist wie folgt

 - (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view {
       if (![view.annotation isKindOfClass:[MKUserLocation class]]) {

          POCustomAnnotation *annotation = (POCustomAnnotation *)[view annotation];

          UIView *bgview=[[UIView alloc]initWithFrame:CGRectMake(-30, -150,130, 150)];
          bgview.backgroundColor=[UIColor grayColor];
          UILabel *templbl=[[UILabel alloc]initWithFrame:CGRectMake(0, 0, 130, 120)];

          templbl.text=annotation.displayText;
          templbl.textAlignment=NSTextAlignmentRight;
          templbl.numberOfLines=10;

          [bgview addSubview:templbl];

          UIButton *tembtn=[UIButton buttonWithType:UIButtonTypeCustom];        
          [tembtn setTitle:@"More info" forState:UIControlStateNormal];
          [tembtn addTarget:self action:@selector(annotationBtnAction:)     
           forControlEvents:UIControlEventTouchUpInside];         
          tembtn.backgroundColor=[UIColor grayColor];   
           tembtn.frame=CGRectMake(0, 121, 130, 30);       
          [bgview addSubview:tembtn];


          [view addSubview:bgview];
    } else {

          POMapAnnotationView *callout = (POMapAnnotationView *)[[[NSBundle mainBundle]loadNibNamed:@"POMapAnnotationView" owner:self options:nil] objectAtIndex:0];
          view.canShowCallout = NO;
          CGRect calloutViewFrame = callout.frame;
          calloutViewFrame.origin = CGPointMake(-calloutViewFrame.size.width / 2 + 15, - calloutViewFrame.size.height);
          callout.frame = calloutViewFrame;
          [callout setLabelText:[self distanceText]];
          [view addSubview:callout];
     }
 }

Ich versuche damit umzugehen

 [tembtn addTarget:self action:@selector(annotationBtnAction:)     
              forControlEvents:UIControlEventTouchUpInside]; 

Das wird nicht gerufen. und mein Bildschirm sieht so aus

Danke im Vorau

Antworten auf die Frage(2)

Ihre Antwort auf die Frage