Advertisement
Guest User

Untitled

a guest
Jun 29th, 2016
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. func addBoundry()
  2. {
  3. var points=[CLLocationCoordinate2DMake(39.02, -76.9),CLLocationCoordinate2DMake(38.97, -76.9),CLLocationCoordinate2DMake(38.97, -77),CLLocationCoordinate2DMake(39.02, -77)]
  4.  
  5. let polygon = MKPolygon(coordinates: &points, count: points.count)
  6.  
  7. mapView.addOverlay(polygon)
  8. }
  9.  
  10. let regionRadius: CLLocationDistance = 1000
  11. func centerMapOnLocation(location: CLLocation) {
  12. let coordinateRegion = MKCoordinateRegionMakeWithDistance(location.coordinate,
  13. regionRadius * 2.0, regionRadius * 2.0)
  14. mapView.setRegion(coordinateRegion, animated: true)
  15. }
  16. func mapView(mapView: MKMapView!, rendererForOverlay overlay: MKOverlay!) -> MKOverlayRenderer! {
  17. if overlay is MKPolygon {
  18. let polygonView = MKPolygonRenderer(overlay: overlay)
  19. //polygonView.strokeColor = UIColor.magentaColor()
  20. polygonView.strokeColor = UIColor(red: 0/255.0, green: 180/255.0, blue: 0/255.0, alpha: 0.4)
  21.  
  22. return polygonView
  23. }
  24.  
  25. return nil
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement