Exporting the map image

1413
12
07-18-2011 10:22 AM
RickJones
Occasional Contributor II
Where would I look for a function to export the mapview's image?
I've tried the reference.
0 Kudos
12 Replies
Nicholas-Furness
Esri Regular Contributor
OK, that's reassuring at least, because that's what I've always got and seems to be what Nimesh expected.

n
0 Kudos
BedaKuster
New Contributor
Thanks for the trick with antialiasing. By the way, same code works for me in (iPad-)simulator...
0 Kudos
RickJones
Occasional Contributor II
If anyone wants to implement a flash effect, here is my code:
(add a white, opaque, fullscreen view panel, zero alpha, over the mapView)

- (void)exportMapViewImage {
//export image of mapView
UIGraphicsBeginImageContextWithOptions(self.mapView.frame.size, NO, 0.0f);
CGContextSetShouldAntialias(UIGraphicsGetCurrentContext(), NO);

[self.mapView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *screenshot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

// implement a flash
self.flashView.alpha = 1;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
self.flashView.alpha = 0;
[UIView commitAnimations];

//save image to photo album
UIImageWriteToSavedPhotosAlbum(screenshot,self,@selector(image:didFinishSavingWithError:contextInfo:),nil);
}
0 Kudos