In which case that mapView:viewForAnnotation: will be called?

前端 未结 2 1466
时光说笑
时光说笑 2020-12-18 08:25

Now I want to add a static pin annotation on map in my iOS app.

But I just want to know if the delegate method mapView:viewForAnnotation: will be called.

In

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-18 08:47

    Whenever you call addAnnotation method - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id < MKAnnotation >)annotation gets called. Have look at the screenshot.

    enter image description here

    You can find this on MKMapView Class Reference

    P.S. Put breakpoints at addAnnotation call and - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id < MKAnnotation >)annotation you will see the flow of function call easily.

提交回复
热议问题