【问题标题】:iOS Google Map Marker with a photo inside round bubble with arrowiOS 谷歌地图标记,带有箭头的圆形气泡内的照片
【发布时间】:2018-10-23 06:37:11
【问题描述】:
【问题讨论】:
标签:
ios
objective-c
google-maps
【解决方案1】:
使用GMSMarker 的iconView 属性将自定义视图呈现为标记。
代码:
UIImage *picture = [UIImage imageNamed:@"Your Picture"];
picture = [picture imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
UIImageView *pictureView = [[UIImageView alloc] initWithImage: picture];
pictureView.tintColor = [UIColor redColor];
CLLocationCoordinate2D position = CLLocationCoordinate2DMake(51.5, -0.127);
GMSMarker *marker = [GMSMarker markerWithPosition:position];
marker.iconView = pictureView;
marker.tracksViewChanges = YES;
marker.map = self.mapView;
欲了解更多,请访问https://developers.google.com/maps/documentation/ios-sdk/marker
【解决方案2】:
试试这个
CLLocationCoordinate2D position = CLLocationCoordinate2DMake(51.5, -0.127);
GMSMarker *london = [GMSMarker markerWithPosition:position];
london.title = @"London";
london.icon = [UIImage imageNamed:@"house"];
london.map = mapView;