【发布时间】:2013-01-09 05:58:55
【问题描述】:
可能重复:
MKPinannotation detail disclosure button - present new view
是否有任何人知道我如何在地图图钉上获得附件按钮(详细信息披露)并在其点击事件上发生一些事件。 谢谢
【问题讨论】:
可能重复:
MKPinannotation detail disclosure button - present new view
是否有任何人知道我如何在地图图钉上获得附件按钮(详细信息披露)并在其点击事件上发生一些事件。 谢谢
【问题讨论】:
您可以使用以下方法将附件按钮添加到您的 pin:
yourPinView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
当您单击附件按钮时,将调用此委托:
- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view
calloutAccessoryControlTapped:(UIControl *)control
{
//do your stuff here
}
【讨论】:
calloutAccessoryControlTapped 将起作用。您可以在那里加载您的网页和其他 sruffs。将 mapview 的委托设置为 self。然后实现上面的委托方法。
如果你想要一些不同的,那就去做
UIButton *DetailViewBtn = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
DetailViewBtn.tag = currentAnnotation.tag;
[DetailViewBtn setTitle:currentAnnotation.title forState:UIControlStateNormal];
[DetailViewBtn addTarget:self
action:@selector(annotationBtnPress:)
forControlEvents:UIControlEventTouchUpInside];
yourAnnotationView.rightCalloutAccessoryView = DetailViewBtn;
这里还有你的方法
-(IBAction)annotationBtnPress:(id)sender
{
NSLog(@"raj");
}
【讨论】: