Mik*_*hen 12
对于SDK:
UIGraphicsBeginImageContext(self.mapView.bounds.size);
[self.mapView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *mapImage = UIGraphicsGetImageFromCurrentImageContext();
Run Code Online (Sandbox Code Playgroud)
对于工具链(使用私有API)
CGRect rect = [self.mapView bounds];
// Change the snapshot rect if needed.
CGImageRef image = [self.mapView createSnapshotWithRect:rect];
Run Code Online (Sandbox Code Playgroud)
CGBitmapContextCreateMKMapView使用[mapView.layer renderInContext:myContext]CGImage使用从上下文中获取CGBitmapContextCreateImageCGImage进去UIImage。