Sending a MKMapView
a -print:
message results in an output that only contains the +/- buttons and the "legal" link. Same if I try [NSPrintOperation printOperationWithView:someMKMapView]
or [theWindowThatContainsAMapView print]
or [[NSPrintOperation PDFOperationWithView:someMKMapView insideRect:someMKMapView.bounds toPath:@"foo.pdf" printInfo:nil] runOperation]
.
Apple's own Maps.app does print the map, btw.
Has anyone managed to print a MKMapView?
The magic class is
MKMapSnapshotter
Assuming there is a
MKMapView
instancemapView
, this is a simple example to create an image of the current content of MKMapView as TIFF file written in Swift. This image is printable.Edit:
with printing instead of creating a file