How to reposition MKMapView's legal label in iOS 11?

Hello, everyone.


I'm in a bit of a hurdle. I am trying to place a UIView on top of a MKMapView, but the view should have a blur effect, so that the map shines through the blur a bit. However, doing this results in the UIView blocking the legal label of the map, and so my app will be rejected from the App Store.

So, my question is, how do i move the legal label? I have tried creating a subclass for MKMapView, and then repositioning the label from there, but this does not seem to work with iOS 11. Here's that piece of code:


class MapViewSubclass: MKMapView {
    override func layoutSubviews() {
        super.layoutSubviews()
        let legalLabel = self.subviews[1]
        legalLabel.center = CGPoint(x: legalLabel.center.x, y: legalLabel.center.y - 80)
    }
}


What I am trying to achieve is somthing like this: https://developer.apple.com/ios/human-interface-guidelines/views/maps/

On the left-most iPhone X you see that the map exends behind the bar in the bottom, but the legal label is still visible on top of the bottom bar.


I am doing this in Swift 4, Xcode 9, and it is an iOS 11 app.


Thnak you 🙂

Answered by TheCD in 265689022

1. Constrain the bottom of your map view to the bottom of its superview (the view controller's view).

2. Constrain the bottom of your visual effect view to the bottom of its superview (the view controller's view).

3. Set the bottom safe area to include the visual effect view's height. Like this:


override func viewDidLoad() {
    super.viewDidLoad()
    additionalSafeAreaInsets = UIEdgeInsetsMake(0.0, 0.0, bottomView.bounds.height, 0.0)
   // If you need support for iOS 10, you should use bottomLayoutGuide instead.
}


Here's a screenshot of what this looks like (remove the space in the URL):


https ://postimg.org/image/8pee2b52z/

Hello,


Here "additionalSafeAreaInsets" was OK with ios11.0

but do not works anymore with xcode9.1beta2 on simulator and real device with 11.1beta4

( for legal label at bottom or compass and scale views behind custom tool view )


GB

Wow, I thought for sure you were mistaken, but sure enough I updated my iPad to 11.1 beta 4 and the MKMapView is not honoring the safeAreaInsets (the compass shows behind a custom view positioned at the top of the map). This is extremely frustrating (combined with https://openradar.appspot.com/34858504 and the unusably slow MKMapView in the simulator, I'm ready to tear my hair out). It's like Apple didn't even test a map view in the simulator. I can't believe Xcode 9 shipped like that.


I've never filed a radar before, and I couldn't see any existing radars for this issue, so I will try to submit something.


EDIT: I just filed https://openradar.appspot.com/35116174. Let's hope they get this resolved soon!

Hi ! Any news from Apple or did you find a way to fix it ?


Thx !

How to reposition MKMapView's legal label in iOS 11?
 
 
Q