2011-11-18 57 views

回答

4

爲什麼不在泡泡中使用按鈕,這就是爲什麼它被設計用於?

- (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation{ 
    MKPinAnnotationView *annView=[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"currentloc"]; 
    annView.pinColor = MKPinAnnotationColorGreen; 
    annView.animatesDrop=TRUE; 
    annView.canShowCallout = YES; 
    annView.calloutOffset = CGPointMake(-5, 5); 

    annotationButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; 
    [annotationButton addTarget:self action:@selector(annotationAction) forControlEvents:UIControlEventTouchUpInside]; 
    annView.rightCalloutAccessoryView = annotationButton; 


    return annView; 
} 
- (void) annotationAction { 
//Call a web view here 
} 
+0

謝謝,我沒有想到它。現在已經很清楚了。 – Hari

+0

很高興我能幫到你 – Spire

相關問題