Last active
November 16, 2017 11:14
-
-
Save takashi1975/6b2b0de237b63721a46ad1dc398d2028 to your computer and use it in GitHub Desktop.
Swift4 GoogleMap(GMSMapView)の中心にMarkerを置く
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //表示している地図の中心の緯度経度 | |
| 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