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.

Content insets are being reverted to 0 #12053

Closed

Description

@clydebarrow

Platform: iOS
Mapbox SDK version: 4.0.2

Steps to trigger behavior

  1. Set content inset on a mapview
  2. hide the mapview by pushing another UIViewcontroller over it
  3. pop the pushed view controller

Expected behavior

Content insets should be the same as before

Actual behavior

Content insets are reverted to 0, and further attempts to set the content insets are ineffective.

The gif shows the original inset offsetting the map center downwards, after showing and removing another view controller, the map has been displaced upwards. Any resetting of the insets from this point on is ineffective.

insets

Activity

  1. clydebarrow commented on Jun 2, 2018

    @clydebarrow
    ContributorAuthor

    This behaviour was not observed on SDK 3.7

  2. clydebarrow commented on Jun 3, 2018

    @clydebarrow
    ContributorAuthor

    The problem appears to be caused by the MGLMapView#layoutSubviews() which has this code:

    - (void)layoutSubviews
    {
        // Calling this here instead of in the scale bar itself because if this is done in the
        // scale bar instance, it triggers a call to this `layoutSubviews` method that calls
        // `_mbglMap->setSize()` just below that triggers rendering update which triggers
        // another scale bar update which causes a rendering update loop and a major performace
        // degradation. The only time the scale bar's intrinsic content size _must_ invalidated
        // is here as a reaction to this object's view dimension changes.
        [self.scaleBar invalidateIntrinsicContentSize];
    
        [super layoutSubviews];
    
        [self adjustContentInset];
    

    And in turn adjustContentInset() is overwriting the previous insets.

    I notice that adjustContentInset() is referencing viewController.automaticallyAdjustsScrollViewInsets which is a deprecated property. Setting to to false on the viewcontroller makes this problem go away, but creates others.

  3. added
    iOS
    on Jun 4, 2018
  4. clydebarrow commented on Jun 8, 2018

    @clydebarrow
    ContributorAuthor

    I have been able to get this to work by setting viewController.automaticallyAdjustsScrollViewInsets to false but this is a kludge, since that property is deprecated and in any case was only intended for use where the view is contained in a UIScrollView. IMHO the functionality of shifting the map logical center point should be separated from any requirement to provide content insets for other purposes, e.g. respecting safe area layout guides.

  5. julianrex commented on Jun 21, 2018

    @julianrex
    Contributor
  6. added
    archived
    on Dec 18, 2018
  7. stale commented on Dec 18, 2018

    @stale

    This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

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

    archivedbugiOS

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions