`[MKAnnotationView setBounds:]` has performance degragation problem on iOS SDK 15

21 Views Asked by At
  • I created a customized annotation view by extending MKAnnotationView, and overriding the [MKAnnotationView setImage:] method.
  • When the [MKAnnotationView setImage:] method is called, [MKAnnotationView setBounds:] is called, and thus [MKAnnotationView _metricsDidChange] and some other methods are called.
  • I see that [MKAnnotationView _metricsDidChange] is the bottleneck for the performance problem.
  • While in SDK 14, there is no such method called.

Attach the time profile screenshot below:

SDK14: enter image description here

SDK15: enter image description here

1

There are 1 best solutions below

0
HongchaoZhang On

Temp fix

I searched but with no luck to find any official materials.

Finally, I found a workaround to make sure the SDK will not call [MKAnnotationView setBounds:] in [MKAnnotationView setImage:] method:

  • set the MWAnnotationView's frame (using the image size) before setting the image to it.

Home this helps.