iphone - Remove MKMapView Annotations with a certain pinColor? -
is possible remove annotations on given mkmapview of given pincolor? i'm trying clear user-entered annotations (pins) on map before displaying new ones part of app, didn't know how granular can in selectively removing annotations...
i'd remove annotations have mkpinannotationcolorgreen (green) pins, i'd able remove pins entered user, if there's way track those.
i know do:
[mymapview removeannotations:mymapview.annotations];
... redraw annotations want, seems waste of resources.
any advice?
i not able test right now, have tried:
nspredicate *predicate = [nspredicate predicatewithformat:@"pincolor == %d", mkpinannotationcolorgreen]; [mymapview removeannotations:[mymapview.annotations filteredarrayusingpredicate:predicate]];
as ones added user, might need keep track of yourself. create own subclass of mkpinannotation. on subclass, add property
@property (nonatomic, bool) addedbyuser;
. set addedbyuser true if added user , filter out using similar approach above (eg. @"addedbyuser == yes").
Comments
Post a Comment