Skip to content

Instantly share code, notes, and snippets.

@takashi1975
Last active November 16, 2017 11:14
Show Gist options
  • Select an option

  • Save takashi1975/6b2b0de237b63721a46ad1dc398d2028 to your computer and use it in GitHub Desktop.

Select an option

Save takashi1975/6b2b0de237b63721a46ad1dc398d2028 to your computer and use it in GitHub Desktop.
Swift4 GoogleMap(GMSMapView)の中心にMarkerを置く
//表示している地図の中心の緯度経度
public static func centerCoordinate(mapView: GMSMapView) -> CLLocationCoordinate2D {
let frame = mapView.frame
let pos = CGPoint(x:mapView.center.x - frame.origin.x,
y:mapView.center.y - frame.origin.y);
//中央の座標
let coordinate = mapView.projection.coordinate(for: pos)
return coordinate;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment