GMSMarker icon from center (iOS)

前端 未结 3 1048
不思量自难忘°
不思量自难忘° 2020-12-29 02:35

I just switched from Apple Maps to Google Maps. An issue that I can\'t seem to find an answer to is how do you make the icon for a GMSMarker to start from the center rather

3条回答
  •  攒了一身酷
    2020-12-29 03:10

    I figured out how to do it after reading Google Maps Documentation very closely. I believe this is how it was intended to be done.

    UIImage *markerIcon = [UIImage imageNamed:@"markericon.png"];
    markerIcon = [markerIcon imageWithAlignmentRectInsets:UIEdgeInsetsMake(0, 0, (markerIcon.size.height/2), 0)];
    self.marker.icon = markerIcon;
    

提交回复
热议问题