Custom MKAnnotation Image goes back to default when I attempt to drag

此生再无相见时 提交于 2019-12-10 03:36:38

问题


I've got a bunch of MKAnnotations that don't need dragging. I set this by [pin setDraggable:NO]. I'm having an issue when I touch the annotation and (accidentally) drag off an annotation, it instantly looses it's custom image and changes back to the default red pin. How do I prevent this from happening?


回答1:


In the viewForAnnotation delegate method, make sure the view is created as an MKAnnotationView and not an MKPinAnnotationView (which is a subclass of MKAnnotationView that automatically provides a pin image).



来源:https://stackoverflow.com/questions/5373265/custom-mkannotation-image-goes-back-to-default-when-i-attempt-to-drag

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