iphone – 从地图Xcode上删除折线

iphone – 从地图Xcode上删除折线,第1张

概述我正在实施一个iPhone应用程序.我有一个地图和对象数组,其中包含要在地图上绘制的坐标.并且在这些点之间绘制折线.所以我想知道如何删除这条折线.不显示/隐藏,但删除. 这是我如何绘制它的代码 int pointCount = [routeLatitudes count] / 2; //routeLatitudes is the array that contains the coordinate 我正在实施一个iPhone应用程序.我有一个地图和对象数组,其中包含要在地图上绘制的坐标.并且在这些点之间绘制折线.所以我想知道如何删除这条折线.不显示/隐藏,但删除.

这是我如何绘制它的代码

int pointCount = [routeLatitudes count] / 2; //routeLatitudes is the array that contains the coordinates latitude followed by longitude.

MKMapPoint* pointArr = malloc(sizeof(MKMapPoint) * pointCount);    int pointArrIndex = 0;      for (int IDx = 0; IDx < [routeLatitudes count]; IDx=IDx+2)    {        CLLocationCoordinate2D workingCoordinate;               workingCoordinate.latitude=[[routeLatitudes objectAtIndex:IDx] doubleValue];        workingCoordinate.longitude=[[routeLatitudes objectAtIndex:IDx+1] doubleValue];          MKMapPoint point = MKMapPointForCoordinate(workingCoordinate);        pointArr[pointArrIndex] = point;        pointArrIndex++;    }       // create the polyline based on the array of points.     routeline = [MKpolyline polylineWithPoints:pointArr count:pointCount];    [mapVIEw addOverlay:routeline];    free(pointArr);

并显示/隐藏折线我创建了一个参考MKOverlayVIEw * overlayVIEw = nil;

overlayVIEw.hIDden=false/true;

现在我需要知道如何删除/删除绘制的折线.

预先感谢.

解决方法 试试这个

[mapVIEw removeOverlays:mapVIEw.overlays];
总结

以上是内存溢出为你收集整理的iphone – 从地图Xcode上删除折线全部内容,希望文章能够帮你解决iphone – 从地图Xcode上删除折线所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1030087.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-23
下一篇 2022-05-23

发表评论

登录后才能评论

评论列表(0条)

保存