Blur on MKMapView

2019-09-08 14:32发布

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条回答
我命由我不由天
2楼-- · 2019-09-08 15:10

Did you try adding blurView to mapView's superview?

Works fine for me in Playground:

Blurred map view in Playground

查看更多
登录 后发表回答