2012-11-14 72 views
0

它也不會給我任何錯誤或警告。我不知道我可以提供什麼其他相關的信息或細節。請告訴我,如果這是不夠的。calloutAccessoryControlTabbed委託不會被調用

  • _mapView.delegate設定中自至極

法calloutAccessoryControl設置:

- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation { 

NSLog(@"Enter viewForAnnotation delegate"); 

static NSString *identifier = @"MyLocation"; 
if ([annotation isKindOfClass:[MapViewAnnotation class]]) { 

    MKPinAnnotationView *annotationView = (MKPinAnnotationView *) [_mapView dequeueReusableAnnotationViewWithIdentifier:identifier]; 
    if (annotationView == nil) { 
     annotationView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier]; 
    } else { 
     annotationView.annotation = annotation; 
    } 

    annotationView.enabled = YES; 
    annotationView.canShowCallout = YES; 

    UIImageView *callOutButtonImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"arrow.png"]]; 
    annotationView.rightCalloutAccessoryView = callOutButtonImage; 

    annotationView.image=[UIImage imageNamed:@"green-node.png"]; 

    return annotationView; 
} 

return nil; 

}

calloutAccessoryControlTabbed:

-(void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control{ 
    NSLog(@"Control Tabbed!"); 
    _scrollView.hidden = false; 
} 

回答

2

以下是來自MKMapViewDelegate協議參考文檔中的mapView:annotationView:calloutAccessoryControlTapped:討論:

配件視圖包含自定義內容,並位於註釋標題文本的任一側。如果您指定的視圖是UIControl類的後代,則無論用戶何時點擊視圖,地圖視圖都會調用此方法。您可以使用此方法響應水龍頭並執行與該控件相關的任何操作。例如,如果您的控件顯示了有關注釋的附加信息,則可以使用此方法以該信息呈現模態面板。

我可以看到您已將UIImage添加到註釋視圖的右側標註附件視圖中。 UIImage對象不會從UIControl繼承。一個UIButton對象可以工作。

相關問題