Hi MilkyJoe,
The following code *might* be faster, depending on what the compiler does:
NSOobject[] annotations = map.Annotations;
foreach (NSObject annotation in annotations) {
if (!(annotation is MKUserLocation)) {
mvMap.RemoveAnnotation (annotation);
}
}
You could also try collecting an array/list of MKAnnotations and then call
map.RemoveAnnotations (array) - that may be slightly faster, but you'd have
to check to see.
Hope that helps,
Jeff
On Thu, Nov 3, 2011 at 1:03 PM, MilkyJoe <[email protected]>wrote:
> Is this the only/best/quickest way to remove all annotations from a MapView
> (except for the one for the user's location)?
>
> foreach (NSObject annotation in map.Annotations) {
> if (!(annotation is MKUserLocation)) {
> mvMap.RemoveAnnotation (annotation);
> }
> }
>
> I've been having trouble with adding annotations to maps, but I got there
> in
> the end. It's more work than I was expecting tbh.
>
>
> --
> View this message in context:
> http://monotouch.2284126.n4.nabble.com/Removing-all-annotations-from-a-MapView-tp3986809p3986809.html
> Sent from the MonoTouch mailing list archive at Nabble.com.
> _______________________________________________
> MonoTouch mailing list
> [email protected]
> http://lists.ximian.com/mailman/listinfo/monotouch
>
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch