English 中文(简体)
地图
原标题:mkmapview refresh mapview

im using mkmapview to show route between current location and a coordinate. im using polyline to show the route. i have added annotation to start and destination. im using the following api to get the in between coordinates.

now if i change the coordinates the already existing route also is visible. how do i remove the existing route and add a new route? thanks in advance.

问题回答

如果你已经计算和显示,那么,除非我没有在你询问中找到任何东西,否则,你们都需要做的是删除旧的一条,并添加新的一条。 你的法典将看像什么。

// generating new data, do this however you like
MKPolyline *routeLine = [self generateNewRoutLine];
MyPinAnnotation *startPin = [self generateNewStartPin];
MyPinAnnotation *endPin = [self generateNewEndPin];

// removing old overlays and adding new
[myMapView removeOverlays:myMapView.overlays]; // removes all overlays
[myMapView removeAnnotations:myMapView.annotations]; // removes all pins
[myMapView addOverlay:routeLine];
[myMapView addAnnotations:[NSArray arrayWithObjects:startPin, endPin, nil]];




相关问题
Code sign Error

I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

将音频Clips从Peter改为服务器

我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......

• 如何将搜查线重新定位?

我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。

热门标签