2016-09-19 1 views
1

Googleマップで地図を実装しています。すべてのマーカーに画像があります。私の質問は、どうすればアイコンを丸くすることができますか? 私は古典的なlayer.cornerRadiusで試してみましたが、うまくいきませんでした。GMSラウンドアイコン

の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; 

とpopulateMap方法:

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 
+0

これまでに試したコードを投稿できますか? – Vin

答えて

0

あなたが簡単に任意の画像操作のためにこれを使用することができます。 Toucan Swift

私の例:

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

enter image description here

+0

Obj-Cなら素敵でしょう。私のプロジェクトはObj-Cです。 Thxとにかく:) – Mavericks13

関連する問題