我在MKMapView的地图上有一个屏幕。如何将此屏幕复制到图像并像使用简单的UIImageView一样使用它。
答案 0 :(得分:5)
这可能有用;
UIGraphicsBeginImageContextWithOptions(MKMapView.bounds.size, MKMapView.opaque, 0.0);
[MKMapView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();