繁体   English   中英

以编程方式为iOS拍摄ArcGIS Map View的屏幕截图

[英]Take Screenshot of ArcGIS Map View Programmatically for iOS

我正在尝试以编程方式拍摄ArcGIS地图视图的屏幕截图。 我没有在ArcGIS库中看到任何代码可以简化这一过程。 我实际上是在尝试创建地图视图的UIImage,其中包括当前正在显示的所有要素图层。 我尝试将UIGraphicsBeginImageContext用于arcgisMapView并在包含arcgisMapView的超级视图上使用,但两次尝试均返回arcgisMapView区域的空白视图。

UIGraphicsBeginImageContext(self.view.bounds.size);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *mapImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(mapImage, nil, nil, nil);

UIGraphicsBeginImageContext(arcgisMapView.bounds.size);
[arcgisMapView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *mapImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(mapImage, nil, nil, nil);

请帮忙,谢谢。

使用exportImageWithCompletion:

https://developers.arcgis.com/ios/latest/swift/sample-code/take-screenshot.htm

和样品来源。

https://github.com/Esri/arcgis-runtime-samples-ios/tree/master/arcgis-ios-sdk-samples/Maps/Take%20screenshot

猜猜ArcGIS使用另一个自定义图层,而不仅仅是self.view.layer

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM