I want to show different annotations at each pin,with my image named "01.png" to "08.png". I set integer a random number from 1~8
integer = arc4random() % 8 + 1;
then set the method -(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id)annotation
if(annotation == mapView.userLocation){
return nil;
}
NSString *identifier = @"Store";
MKAnnotationView *result = (MKAnnotationView*)[mapView dequeueReusableAnnotationViewWithIdentifier:identifier];
if(result == nil){
result = [[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier];
} else {
result.annotation = annotation;
}
NSString * imageName = [NSString stringWithFormat:@"0%i",integer];
UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"%@",imageName]];
result.image = image;
return result;
but the mapView show the same annotations,it will show different annotations at each time I open the apps.
How to show different annotations at each pin?
Thank you very much!