How to deal with lag resulting from hundreds of map annotations on an MKMapView?
I'm in a situation where there will be 500+ annotations to load onto a map. What some ways that you have dealt with the resulting lag with so many annotations on the map?
One thing I've considered: only loading a portion of the annotations based on the current map r开发者_JS百科egion in view. But what happens when they zoom out or move around? Reload based on the region displayed?
MKMapView
has a dequeueReusableAnnotationViewWithIdentifier:
method (documentation) that I believe you're supposed to use. It looks like it works similarly to UITableView
's dequeueReusableCellWithIdentifier:
method.
Another thing might be to group clustered pins together into one pin. As you zoom in, you can expand these groups.
update: Found a cool open-source library that might be useful for dealing with tons of annotation points: ADClusterMapView
精彩评论