是的,您正在覆盖价值。您应该创建另一个标记。
GMSMarker *marker = [[GMSMarker alloc] init];
marker.position=CLLocationCoordinate2DMake(toLatitudeDouble, toLongitudeDouble);
marker.title=toLocationFromResultVC; marker.snippet=@"Destination";
// Your're overriding the value here!!
// use GMSMarker *marker2 = [[GMSMarker alloc] init]; and reference it instead in the code below.
marker.position=CLLocationCoordinate2DMake(fromLatitudeDouble, fromLongitudeDouble);
marker.title=fromLocationFromResultVC; marker.snippet=@"Source";
marker.map = mapView_;
所以,正确的代码是
GMSMarker *marker = [[GMSMarker alloc] init];
marker.position=CLLocationCoordinate2DMake(toLatitudeDouble, toLongitudeDouble);
marker.title=toLocationFromResultVC; marker.snippet=@"Destination";
marker.map = mapView_;
GMSMarker *marker2 = [[GMSMarker alloc] init];
marker2.position=CLLocationCoordinate2DMake(fromLatitudeDouble, fromLongitudeDouble);
marker2.title=fromLocationFromResultVC; marker.snippet=@"Source";
marker2.map = mapView_;