将MKMapView渲染到UIImage的代码不再适用于iOS 7.它返回一个空白图像,其底部只有单词“Legal”,右上角是黑色指南针。地图本身缺失。以下是我的代码:MKMapView到UIImage iOS 7
UIGraphicsBeginImageContext(map.bounds.size);
[map.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
Map是一个指向MKMapView的IBOutlet。有没有办法在iOS 7中正确呈现MKMapView?
您是否尝试使用'drawViewHierarchyInRect:afterScreenUpdates:'而不是'renderInContext:'? –