0

I have a MKMapView which fills the whole screen.

I want to blur the map with this code in Swift:

var blurMap = UIBlurEffect(style: UIBlurEffectStyle.Light)
var blurMapView = UIVisualEffectView(effect: blurMap)
blurMapView.frame = mapView.bounds
mapView.addSubview(blurMapView)

It works, but with bigger screens (iPhone 6 and iPhone 6 plus) the blur affects just to a part of the map. With iPhone 4s and 5/5s the blur fills all the screen.

enter image description here

This is with iPhone 6/6 plus. If I run it with an iPhone 4/5/5s it works great.

I don't know if it could the problem of the simulator, I don't have any iPhone 6 so I can't test it in a real device.

What would you think this issue comes from?

Christian
  • 22,585
  • 9
  • 80
  • 106
Aitor Sola
  • 17
  • 5
  • It is preferred if you could show the image in the post, instead of asking others to go to (possibly malicious) sites. – erdekhayser Mar 15 '15 at 23:06
  • Thanks for editing, I could't post the image because I wasn't allowed :P – Aitor Sola Mar 15 '15 at 23:14
  • Where do you add the blur effect? In which function? – Arbitur Mar 15 '15 at 23:45
  • I declarate the blur effect with the lines below: var blurMap = UIBlurEffect(style: UIBlurEffectStyle.Light) var blurMapView = UIVisualEffectView(effect: blurMap) Then I add the subview: mapView.addSubview(blurMapView) – Aitor Sola Mar 16 '15 at 09:55
  • @AitorSola, I think Arbitur is asking what function is this code in? Is it in viewDidLoad, viewWillAppear, viewDidAppear, other? It's possible that the blur view is being added before auto-layout has finished resizing the map view (ie. map view size changes after the blur view is added). Also, I wouldn't add it as a subview of the map view but as a subview of the map view's parent (to self.view and setting frame to mapView.frame). –  Mar 16 '15 at 11:23
  • Oh excuse me! The code is in ViewDidLoad. How would you modify the code or where would you place the code? – Aitor Sola Mar 16 '15 at 12:12
  • @Anna this happen only in iPhone 6 and 6 plus. Not in iPhone 4, 5, 5s. It happens when the screen is big. – Aitor Sola Mar 16 '15 at 12:35

0 Answers0