Blur on MKMapView

2019-09-08 14:43发布

问题:

I know this question has been asked before, but I am trying to put a blur on a map view in my app. Everything I've tried just tints the map including code like this:

var darkBlur = UIBlurEffect(style: UIBlurEffectStyle.Dark)
var blurView = UIVisualEffectView(effect: darkBlur)
blurView.frame = mapView.bounds
mapView.addSubview(blurView)

Is there a way to actually blur the map?

回答1:

Did you try adding blurView to mapView's superview?

Works fine for me in Playground: