c.map = self.map
行因 EXC_BAD_ACCESS而失败。
来自文档:
/**
* The map this overlay is on. Setting this property will add the overlay to the
* map. Setting it to nil removes this overlay from the map. An overlay may be
* active on at most one map at any given time.
*/
@property(nonatomic, weak) GMSMapView *GMS_NULLABLE_PTR map;
- (void)showResult:(GMSPlace *)place {
self.place = place;
GMSCameraPosition *position = [[GMSCameraPosition alloc] initWithTarget:place.coordinate zoom:16 bearing:0 viewingAngle:0];
[self.map setCamera:position];
GMSCircle *c = [[GMSCircle alloc] init];
c.radius = 75 * 1609.344;
c.fillColor = [UIColor blueColor];
c.map = self.map;
}
答案 0 :(得分:1)
您需要使用GMSCircle
指定CLLocationCoordinate2D
的位置
c.position = coordinate; // Some CLLocationCoordinate2D position
c.map = self.map
同时为fillColor
提供较少的alpha
,以便显示地图。
希望这会对你有所帮助。