如何清除mkmapview的缓存 [英] How to clear the cache of mkmapview

查看:93
本文介绍了如何清除mkmapview的缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我有一个文本框和一个搜索按钮.当用户在填写文本框上的地址后单击搜索按钮时,我的应用程序将显示结果并在地图视图上放置图钉. 我正在使用google maps api.我还添加了用户可以拖放图钉的功能.当用户将图钉拖放到另一个位置上时.应删除上一个图钉.要删除该图钉,我正在使用[mapView removeAnnotation [mapView.annotations lastObject]];

In my app.I have a one textfield and one search button.when it user click on search button after fill up the address on textfield my app shows the result and place a pin on mapview. I am using google maps api for it. I have also added the functionality user can drag and drop the pin. when the user drag the pin and drop on another place.The previous pin should be removed.For removing that pin i am using [mapView removeAnnotation[mapView.annotations lastObject]];

但是当我再次搜索已经搜索的新地址时,它又创建了一个新的图钉.我知道这来自mkmapview的缓存. **现在我该如何从mkmapview中删除它(pin)

but when i again search a new address which is already search.It again created a new pin. I know this is coming from cache of mkmapview. **Now how can i remove it(pin) from mkmapview

推荐答案

尝试一下

NSURLCache *sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:0 diskCapacity:0 diskPath:nil]; 

[NSURLCache setSharedURLCache:sharedCache];
 [sharedCache release];

这篇关于如何清除mkmapview的缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆