这可能会帮助您解决问题
NSMutableArray *infoArray; // Load ImageURLS you fetch from database here
例子:
for (int i = 0; i < 20; i++)
{
NSString *imageURLString;
if (i%2==0) {
imageURLString = @"http://www.mokriya.com/images/tree_people_150px.png";
} else {
imageURLString = @"http://www.mokriya.com/images/mokriyalogo_sm.png";
}
NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithObjectsAndKeys:imageURLString,@"image_url", nil];
[infoArray addObject:dict];
[dict release];
}
在mapview的委托方法里面
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
使用此代码
NSMutableDictionary *dict = [self.infoArray objectAtIndex:anno.tag];
NSURL *ImageURL = [NSURL URLWithString:[dict valueForKey:@"image_url"]];
[pinView setImageWithURL:ImageURL placeholderImage:[UIImage imageNamed:@"loading.png"]];
我们还将更改推送到
https://github.com/mokriya/customMKAnnotationView