注释标注副标题是否可以成为启动Safari的链接?

时间:2011-11-18 13:28:14

标签: iphone ios mkmapview mkannotation

我想在MKAnnotationPoint的Callout Bubble中添加一个副标题,这个链接会启动最终进入该链接的Safari浏览器。这可能吗?

1 个答案:

答案 0 :(得分: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
}