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