0
我想加上註釋, 一個按鈕,但我發現在網上的錯誤時:編譯器錯誤調用dequeueReusableAnnotationViewWithIdentifier
MKPinAnnotationView *annotationView = (MKPinAnnotationView *)[MapView dequeueReusableAnnotationViewWithIdentifier:identifier];
這表明:
沒有已知的類方法爲選擇器dequeueReusableAnnotationViewWithIdentifier。
我真的不知道如何解決它我欣賞任何幫助。
-(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation {
static NSString *identifier = @"MyLocation";
if ([annotation isKindOfClass:[MapAnnotation 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;
// Create a UIButton object to add on the
UIButton *leftButton = [UIButton buttonWithType:UIButtonTypeInfoDark];
[leftButton setTitle:annotation.title forState:UIControlStateNormal];
[annotationView setLeftCalloutAccessoryView:leftButton];
return annotationView;
}
}
Thankssss !!我不知道我有多想念它 – Alaa12