这是我想做的:
- 找到一些目的地。
- 在 map 中将其呈现为 View 。
- 将其转换为图像,然后我可以将其保存并用作背景。
另一种选择是放下 map View ,关闭所有输入并在其上绘制。基本上要求一种栅格化 map View 的方法。想知道是否有人这样做过。
最佳答案
您可以使用类似这样的方式将任何 View 渲染到图像中:
UIGraphicsBeginImageContextWithOptions(mapView.bounds.size, NO, 0.0f);
[mapView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *mapImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
关于ios - 在 iOS 中从 map 生成图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14533239/