[英]calloutAccessoryControlTabbed delegate does not get called
它也不會給我任何錯誤或警告。 我不知道我可以提供哪些其他相關信息或細節。 如果這還不夠,請告訴我。
設置 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;
}
以下來自mapView:annotationView:calloutAccessoryControlTapped:
MKMapViewDelegate協議參考文檔中的討論:
附件視圖包含自定義內容並位於注釋標題文本的任一側。 如果您指定的視圖是 UIControl 類的后代,則每當用戶點擊您的視圖時,地圖視圖都會調用此方法以方便。 您可以使用此方法響應點擊並執行與該控件關聯的任何操作。 例如,如果您的控件顯示有關注釋的附加信息,您可以使用此方法來顯示包含該信息的模式面板。
我可以看到您已將 UIImage 添加到注釋視圖的右側標注附件視圖中。 UIImage 對象不從 UIControl 繼承。 UIButton 對象會起作用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.