MKMapView and dequeueReusableAnnotationViewWithIdentifier:

I have an MKMapView with approximately 1000 MKPinAnnotationView on the screen at the same time.

It has extremely slow scroll performance.

I am trying to modify my annotations accordingly as follows:

- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation {
    static NSString *viewIdentifier = @"annotationView";
    MKPinAnnotationView *annotationView = (MKPinAnnotationView *) [mapView dequeueReusableAnnotationViewWithIdentifier:viewIdentifier];
    if (annotationView == nil) {
        annotationView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:viewIdentifier] autorelease];
    }

    return annotationView;
}

However, my annotations are never reused! I have 1000 instances of MKPinAnnotationView on my map at the same time. I cannot help but feel that this contributes to poor performance.

Is this the right way to remove overriding annotations? Aren't they reused because they are all on the same screen at the same time and therefore require separate instances?

Any tips for speeding up scrolling with lots of on-screen contacts?

+3
4

, . , .

, 1000 - , , .

, iPhone 3G, 100-150, (, , ).

, MKMapView, .

1) , , ( , , , ).

2) , , .

+2

. , . , .

, , , . , - .

+1

, "" , . .

: MKMapView ( , )

0

iOS 4.3 SDK? , , , iOS 4.3 .

MKMapView ( , )

0

Source: https://habr.com/ru/post/1717323/


All Articles