我想在MKAnnotationPoint的标注气泡中添加字幕,以启动Safari浏览器并最终转到该链接。这可能吗?

最佳答案

您为什么不在气泡中使用按钮,这就是为什么它被设计用于?

- (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
}

关于iphone - 注释标注字幕可以是启动 Safari 的链接吗?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8183142/

10-10 03:57