Is there a way to remove the last added Annotation?
Asked
Active
Viewed 1,802 times
0
-
See http://stackoverflow.com/questions/13017305/how-to-reorder-mkmapview-annotations-array and http://stackoverflow.com/questions/9539802/mkmapview-annotations-changing-losing-order?lq=1 for an explanation of why using the map view's annotations array won't always work. – Nov 08 '12 at 13:03
1 Answers
4
[self.mapView removeAnnotation:self.mapView.annotations.lastObject];
fulvio
- 25,423
- 20
- 127
- 202
HackyStack
- 4,609
- 3
- 21
- 28
-
1
-
2unfortunatly this doesn't solve the problem, because the last object is the Userlocation. So I thought I remove the second last object but I found out, that this is not always the last added Annotation (no idea why). But I solved my problem now by just adding the annotation to an array and taking this for deleting the last annotation. But nevertheless thanks for your help! – MotoxX Nov 08 '12 at 07:40