1

I'm implementing a map with google maps and for every marker I have an image. My question is: how can I make the icon round? I try with classical layer.cornerRadius but it didn't work.

viewDidLoad

self.artistImageView = [[UIImageView alloc] init];
self.artistImageView.layer.cornerRadius = self.artistImageView.frame.size.width / 2.0f;
self.artistImageView.layer.borderWidth = 2.0f;
self.artistImageView.layer.borderColor = [UIColor blackColor].CGColor;
self.artistImageView.layer.masksToBounds = YES;

and populateMap method:

FBMarker *marker = [FBMarker markerWithPosition:pin.coordinate];
marker.title = pin.title;
self.artistImageView.image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:artist.artistImage]]];
marker.icon = self.artistImageView.image;
marker.subtitle = pin.subtitle;
marker.phone = pin.phone;
marker.map = self.mapView

1 Answers1

0

you can easy use this for any image operations : Toucan Swift

My example :

  marker.icon = Toucan(image: marker.icon!).maskWithEllipse(borderWidth: 2, borderColor: UIColor.whiteColor()).image

enter image description here

SIgalGleb
  • 71
  • 9