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

爷,独闯天下 提交于 2019-11-29 07:48:33

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

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.

Obviously MKMapView at least will call mapView:viewForAnnotation: when it will need to display your MKAnnotationView to the screen.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!