Last active
August 29, 2015 14:20
-
-
Save Busta117/3ab5df699a6adf7d6d01 to your computer and use it in GitHub Desktop.
This file contains 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
func centerMapWithCoords(coordsArr:[CLLocationCoordinate2D]){ | |
var zoomRect:MKMapRect = MKMapRectNull; | |
for coord:CLLocationCoordinate2D in coordsArr { | |
var annotationPoint: MKMapPoint = MKMapPointForCoordinate(coord) | |
var pointRect:MKMapRect = MKMapRectMake(annotationPoint.x, annotationPoint.y, 0, 0) | |
zoomRect = MKMapRectUnion(zoomRect, pointRect) | |
} | |
mapView.setVisibleMapRect(zoomRect, edgePadding:UIEdgeInsetsMake(150, 30, 30, 30), animated:false) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment