ios - Remove subviews from an UIView perfomantly? -
hi i'm writing ios tiled map component in monotouch requires me remove , add large number of (markers)uiviews parent uiview part of main thread.
i implementing clustering pins. become close cluster nodes displaying number of pins node represents. depending on zoom level need add , remove pins move in , out of nodes
adding views fine can done in bulk with
_parentview.addsubviews (viewstoadd.toarray());
plus can chunked.
but remove killing performance each individual view has removed a
view.removefromsuperview (); view.dispose ();
is there way speed operation?
i looked putting views nsarray , using performselector remove superview couldn't find correct syntax in mono touch
thanks luke
i think should consider recycling views instead of disposing them , creating new ones. apple's mkmapview
provides, don't mention if using or not. works adding number of mkplacemark
objects, represented mkannotationview
recyclable views scroll around map.
there reasonable example in xamarin's field service app of using mkmapview's
dequeuereusableannotation
method. scroll down mapviewdelegate
nested class.
if using map library, google maps, should consider keeping queue<t>
of views in order recycle them. way can merely call addsubview
, removefromsuperview
, not create new objects on , over.
Comments
Post a Comment