I\'d like to a-synchronically load images for my custom MKAnnotationView; I\'m already using the EGOImageView-framework (it goes very well with UITableViews), but I fail to make
This worked for me
#import "EGOImageView.h"
- (MKAnnotationView *)mapView:(MKMapView *)theMapView viewForAnnotation:(id <MKAnnotation>)annotation
{
//ENTER_METHOD;
if([annotation isKindOfClass:[MKUserLocation class]]) return nil;
MKPinAnnotationView *annView;
static NSString *reuseIdentifier = @"reusedAnnView";
annView = [[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:reuseIdentifier];
annView.canShowCallout = YES;
annView.calloutOffset = CGPointMake(-5.0f, 0.0f);
annView.opaque = NO;
annView.image = [[UIImage imageNamed:@"tempImage.png"] retain];
YourModel *p = annotation; // make this conform to <MKAnnotation>
EGOImageView *egoIV = [[EGOImageView alloc] initWithPlaceholderImage:[UIImage imageNamed:@"tempImage.png"]];
[egoIV setDelegate:self];
egoIV.imageURL = [NSURL URLWithString:p.theUrlToDownloadFrom];
[annView addSubview:egoIV];
[egoIV release];
return [annView autorelease];
}