【发布时间】:2013-10-02 01:53:41
【问题描述】:
将 MKMapView 渲染到 UIImage 的代码在 iOS 7 中不再有效。它返回一个空图像,底部只有单词“Legal”,右上角有一个黑色指南针。地图本身不见了。以下是我的代码:
UIGraphicsBeginImageContext(map.bounds.size);
[map.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
Map 是一个指向 MKMapView 的 IBOutlet。有什么方法可以在 iOS 7 中正确呈现 MKMapView?
【问题讨论】:
-
您是否尝试使用
drawViewHierarchyInRect:afterScreenUpdates:而不是renderInContext:?
标签: iphone ios objective-c uiimage mkmapview