Я хочу показать свои пользовательские аннотации на карте и мое текущее местоположение в качестве стандартного вывода на карте с синим цветом.стандартная аннотация карты для iOS
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation {
static NSString *identifier = @"MapPin";
if ([annotation isKindOfClass:[MyAnnotations class]]) {
MyAnnotations *ann= annotation;
MKAnnotationView *annotationView = (MKAnnotationView *) [self.map dequeueReusableAnnotationViewWithIdentifier:identifier];
if (annotationView == nil) {
annotationView = [[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier];
if (ann.custom){
annotationView.image = [UIImage imageNamed:@"custom.png"];
}else{
//?? annotationView.image = [UIImage imageNamed:@"bluePin.png?"];
}
} else {
annotationView.annotation = annotation;
}
if(ann.custom){
UIButton *nextButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
[nextButton addTarget:self action:@selector(annotationPicked) forControlEvents:UIControlEventTouchUpInside];
annotationView.rightCalloutAccessoryView=nextButton;
}
annotationView.enabled = YES;
annotationView.canShowCallout = YES;
annotationView.multipleTouchEnabled = NO;
return annotationView;
}
return nil;
}
Я просмотрел: else if ([аннотация isKindOfClass: [MKUserLocation class]]) { return nil; }, но нажатие на аннотацию аннотаций пользователя ... –
Код, который вы пробовали в своем комментарии, кажется, не имеет отношения к вашему первоначальному вопросу, а также к сбою (для которого было бы полезно получить точное сообщение об исключении). – Anna