I want to achieve the custom effect of Baidu Maps pin. What I want to show is not a red pin, but a picture, the size of which is unknown. I tried many methods.
The first is to directly transfer (BMKPinAnnotationView)annotationView.image设置成网络下载的图片的，但是有两个问题，1是图片太大，不是大头针的效果，2是不能处理成圆形。
第二种：新建一个UIImageView，往UIImageView.image添加图片，然后设置大小和圆形效果，最后添加到(BMKPinAnnotationView) on the annotationView. However, if the coverage is not good, it will always be a little bit biased. If I set IMG View. Center = Annotation View. Center offset very seriously, if IMG View. Frame = CGRECTMAKE (0,0,20,20) directly, it will be a little cheaper and not very nice.
Third, instead of BMKPinAnnotationView, BMKAnnotationView is used to add UIImageView, because there is no pin, there will be no offset. however, if the click event is gone, there will be no response at all. if UIImageView is replaced by UIButton, it will not be possible to add a click event to button.
Ask the expert if there is a better way.
You need a good UI to help you make the map, so you don’t have to do it yourself.
Just go to bundle and replace Baidu’s default picture.