Reputation: 111
I'm trying to add ovarlay on full map space. I tried use
@available(iOS 4.0, *)public let MKMapRectWorld: MKMapRect
but I can't find a correct way how to do it.
Upvotes: 2
Views: 1284
Reputation: 111
I've found a way.
add overlay to map view in for exmple viewDidLoad:
if let fullRadius = CLLocationDistance(exactly: MKMapRectWorld.size.height) {
mapView.add(MKCircle(center: mapView.centerCoordinate, radius: fullRadius))
}
and implement delegate method:
func mapView(_ mapView: MKMapView, rendererFor overlay: MKOverlay) -> MKOverlayRenderer {
if overlay.isKind(of: MKCircle.self) {
let view = MKCircleRenderer(overlay: overlay)
view.fillColor = UIColor.blue.withAlphaComponent(0.1)
return view
}
return MKOverlayRenderer(overlay: overlay)
}
Upvotes: 5