0
我想添加一个按钮到注释视图并为其分配一个操作。我有种想法,只有我的代码有一个小问题。现在将细节按钮添加到MKAnnotationView
// so when I touch the pin , and the annotation view is displayed , I create a button and add it to the view
- (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view
{
view.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
}
// when the button is pressed , go to another view
- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control
{
NSLog(@"calloutAccessoryControlTapped");
ArticleViewController *det = [[ArticleViewController alloc]init];
det.leTitle = view.annotation.title;
det.link = @"http://en.wikipedia.org/wiki/San_Francisco";
[self.navigationController pushViewController:det animated:YES];
}
,问题是,我第一次接触到的注释和创建按钮, 的
- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control
功能不起作用。只有在取消选择注释并再次触摸它后,它才能正常工作。你能帮我提供我的代码吗?谢谢。
如果您的问题解决了,请不要忘记接受您的答案。 – 2012-02-28 09:15:51