Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

MGLMapView contentInset top is ignored for compass positioning #11068

Closed

Description

@dmdeller

Platform: iOS
Mapbox SDK version: 3.7.3

Hi there,

We have been using contentInset.top to position the compass on our MGLMapView, in order to move it out of the way of some other views that we place on top of the map view. This has worked fine until recently, but was broken in Mapbox 3.7.2.

Steps to trigger behavior

Our usage looks like this: (Swift; edited for clarity)

let mapView = MGLMapView(frame: UIScreen.main.bounds, styleURL: styleURL)
mapView.zoomLevel = 12
mapView.showsUserLocation = true
mapView.setUserTrackingMode(.follow, animated: false)
mapView.contentInset = UIEdgeInsets(top: 60, left: 0, bottom: 0, right: 0)
mapView.updateConstraints()
mapView.delegate = self
view.insertSubview(mapView, at: 0)

Expected behavior

The compass should be positioned at least 60 points below the top of the MGLMapView.

Actual behavior

The compass is positioned at the top of MGLMapView. Setting contentInset makes no difference to the vertical positioning.

More info

I regression tested it on these Mapbox versions:

3.6.4: ✅ as expected
3.7.0: ✅ as expected
3.7.1: ✅ as expected
3.7.2: ❌ not as expected
3.7.3: ❌ not as expected

I think this commit may have been the breaking change: d650b91

Note that the left side of the diff references contentInset.top but the right side does not.

Question


Is this a bug, or was this change intentional? If the latter, do you have another recommendation for how to position the compass?

Thanks!

Activity

  1. added
    iOS
    on Jan 26, 2018
  2. RobertSasak commented on May 19, 2018

    @RobertSasak

    Is there any workaround?

  3. julianrex commented on Nov 6, 2018

    @julianrex
    Contributor

    @dmdeller can you confirm that automaticallyAdjustsScrollViewInsets was set to NO?

  4. dmdeller commented on Nov 8, 2018

    @dmdeller
    Author

    @julianrex Confirmed, automaticallyAdjustsScrollViewInsets was set to NO. The problem occurs whether this is set to NO or YES. I also confirmed it still occurs under Mapbox 4.5.0.

  5. julianrex commented on Nov 14, 2018

    @julianrex
    Contributor

    Making a note that the ideal solution here should involve integrating the Adopt layout anchors #12147 PR.

  6. removed their assignment
    on Dec 18, 2018
  7. julianrex commented on Feb 28, 2019

    @julianrex
    Contributor

    Noting that this issue should be addressed by #13911 which is currently in review. /cc @chloekraw

  8. julianrex commented on Mar 21, 2019

    @julianrex
    Contributor

    @dmdeller #13911 has now merged and will be available in an upcoming release. This is the supported mechanism for moving "ornaments" like the compass.

    I'm going to close this issue, but please reopen if necessary!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugiOS

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions