用户位置引脚的自定义注释
Custom annotation for userlocation pin
似乎可以更改用户位置注释图像。
如果...
也许有人能看出我错在哪里
-(MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation {
if ([annotation isKindOfClass:[MKUserLocation class]]) {
NSString* AnnotationIdentifier = @"Annotation";
MKAnnotationView *annoationView = [mapView dequeueReusableAnnotationViewWithIdentifier:AnnotationIdentifier];
[annoationView setImage:[UIImage imageNamed:@"melocation"] ];
return annoationView;
}
}
注解无法出队时第一次忘记初始化:
-(MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation {
if ([annotation isKindOfClass:[MKUserLocation class]]) {
static NSString* const kAnnotationIdentifier = @"Annotation";
MKAnnotationView *annoationView = [mapView dequeueReusableAnnotationViewWithIdentifier:kAnnotationIdentifier];
if (!annoationView) {
annoationView = [[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:kAnnotationIdentifier];
}
[annoationView setImage:[UIImage imageNamed:@"melocation"] ];
return annoationView;
}
return nil;
}
似乎可以更改用户位置注释图像。 如果...
也许有人能看出我错在哪里-(MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation {
if ([annotation isKindOfClass:[MKUserLocation class]]) {
NSString* AnnotationIdentifier = @"Annotation";
MKAnnotationView *annoationView = [mapView dequeueReusableAnnotationViewWithIdentifier:AnnotationIdentifier];
[annoationView setImage:[UIImage imageNamed:@"melocation"] ];
return annoationView;
}
}
注解无法出队时第一次忘记初始化:
-(MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation {
if ([annotation isKindOfClass:[MKUserLocation class]]) {
static NSString* const kAnnotationIdentifier = @"Annotation";
MKAnnotationView *annoationView = [mapView dequeueReusableAnnotationViewWithIdentifier:kAnnotationIdentifier];
if (!annoationView) {
annoationView = [[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:kAnnotationIdentifier];
}
[annoationView setImage:[UIImage imageNamed:@"melocation"] ];
return annoationView;
}
return nil;
}