Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/104.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
来自url而非资源的自定义图标-nativescript谷歌地图ios_Ios_Google Maps Markers_Nativescript Angular - Fatal编程技术网

来自url而非资源的自定义图标-nativescript谷歌地图ios

来自url而非资源的自定义图标-nativescript谷歌地图ios,ios,google-maps-markers,nativescript-angular,Ios,Google Maps Markers,Nativescript Angular,我尝试了很多,但并没有成功地找到一种方法来显示从url标记的图标 addMarker(mark, index): void { const marker = new Marker(); marker.position = Position.positionFromLatLng(mark.latitude, mark.longitude); marker.icon = 'iconsdb.com/icons/preview/red/map-marker-2-xxl.png'

我尝试了很多,但并没有成功地找到一种方法来显示从url标记的图标

 addMarker(mark, index): void {
    const marker = new Marker();
    marker.position = Position.positionFromLatLng(mark.latitude, mark.longitude);
    marker.icon = 'iconsdb.com/icons/preview/red/map-marker-2-xxl.png'; // default pin
    this.mapView.addMarker(marker);
 }

使用来自资源的图标图像工作正常。现在我有图标存储在云上,我需要根据记录使用它们

由于从资产加载图像与ImageSource一起工作,我相信您应该能够对URL中的图像执行类似的操作。也看到

ImageSource有一个可以调用的“fromUrl”。所以这应该对你有用(从你的链接问题中借用部分代码)

您可能应该下载该图像,这样它就不会被下载x次

 let imgSrc = new ImageSource();
 imgSrc.fromUrl("iconsdb.com/icons/preview/red/map-marker-2-xxl.png");

 let image = new Image();
 image.imageSource = imgSrc;

 marker.icon = image;