I'm trying to create a Map with photos kind of like Instagrams Photo Map.
Photo Map: http://i.stack.imgur.com/B0wDa.jpg
How can I get the Image (loaded from Parse), to the annotation, like in the screenshot above?
And this is what I got so far:
MapViewController.m
[PFGeoPoint geoPointForCurrentLocationInBackground:^(PFGeoPoint *geoPoint, NSError *error) {
PFQuery *query = [PFQuery queryWithClassName: @"HomePopulation"];
[query whereKey:@"geopoint" nearGeoPoint:geoPoint withinKilometers:3000];
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
if (!error) {
for (PFObject *object in objects) {
PFGeoPoint *thePoint = [object objectForKey:@"geopoint"];
latitude = thePoint.latitude;
longitude = thePoint.longitude;
NSLog(@" Hej %f, %f", latitude, longitude);
CLLocationCoordinate2D annotationCoordinate = CLLocationCoordinate2DMake(latitude, longitude);
Annotation *annotation = [[Annotation alloc] init];
annotation.coordinate = annotationCoordinate;
annotation.title = [object objectForKey:@"discovery"];
annotation.subtitle = [object objectForKey:@"location"];
PFFile *image = [object objectForKey:@"imageFile"];
annotation.imageView.file = image;
[annotation.imageView loadInBackground];
[self.theMap addAnnotation:annotation];
[self.theMap setCenterCoordinate:annotation.coordinate animated:YES];
[self setNeedsStatusBarAppearanceUpdate];
}
}
}];
}];
Any help appreciated.
Marko
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…