views:

183

answers:

1

Hi,

I am new to iphone development.I have created map applications and displayed the cuurent location and drop a pin to the current location.On clicking the button "Find Me", it drops a pin in my current location.Once again if i click the "Find Me" button it drops a pin but i am able to see the previously dropped pin in my current location. So i want to remove the previously dropped pin when i am clicking the "Find Me" button twice. Please help me out.

Thanks.

+1  A: 

Store your annotation object somewhere and when you want to remove it just call -removeAnnotation: method with it:

[mapView removeAnnotation: annotationObject];

Note also that if you set your map view's showsUserLocation property to YES it will automatically track user location using Core Location framework services and display it on the map.

Vladimir
Thanks a lot, it works fine.
Pugal Devan